Well:

I think that I solved my issue in the next way:


val variable_fieldsStr = List("field1","field2")
val variable_argument_list= variable_fieldsStr.map(f => Alias(Symbol(f),
f)())

val schm2 = myschemaRDD.select(variable_argument_list:_*)


schm2 seems to have the required fields, but would like to hear the opinion
of an expert about it.



Thanks

On Thu, Feb 19, 2015 at 12:01 PM, Cesar Flores <ces...@gmail.com> wrote:

>
> I am trying to pass a variable number of arguments to the select function
> of a SchemaRDD I created, as I want to select the fields in run time:
>
>
> val variable_argument_list = List('field1,'field2')
>
> val schm1 = myschemaRDD.select('field1,'field2) // works
> val schm2 = myschemaRDD.select(variable_argument_list:_*) // do not work
>
>
> I am interested in selecting in run time the fields
> from myschemaRDD variable. However, the usual way of passing variable
> number of arguments as a List in Scala fails.
>
> Is there a way of selecting a variable number of arguments in the select
> function? If not, what will be a better approach for selecting the required
> fields in run time?
>
>
>
> Thanks in advance for your help
> --
> Cesar Flores
>



-- 
Cesar Flores

Reply via email to