You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Guillermo Ortiz <ko...@gmail.com> on 2018/03/31 00:15:39 UTC

Trying to save in cassandra with "SomeColumns"

The poblem is that I have a method from Spark to insert into Cassandra:
childrenToInsertToParent.saveToCassandra("keyspace", "table",
SomeColumns("a","b","c","d"))

I have to put an sequence of String to say what columns I want to save. I
would like to do it dinamically, to do that I have to save these names in
an array, but it doesn't work with this paramter, any way to set an array
to this method or similar?

My idea is to get the name of the attributes from my case classes and put
them directly, but I just can set the names in an array, list and so on.

Re: Trying to save in cassandra with "SomeColumns"

Posted by Eric Stevens <mi...@gmail.com>.
You can fill in var-args with SomeColumns(myColumns:_*) style syntax.

See for example:
https://stackoverflow.com/questions/1832061/scala-pass-seq-to-var-args-functions

On Fri, Mar 30, 2018 at 6:15 PM Guillermo Ortiz <ko...@gmail.com>
wrote:

>
> The poblem is that I have a method from Spark to insert into Cassandra:
> childrenToInsertToParent.saveToCassandra("keyspace", "table",
> SomeColumns("a","b","c","d"))
>
> I have to put an sequence of String to say what columns I want to save. I
> would like to do it dinamically, to do that I have to save these names in
> an array, but it doesn't work with this paramter, any way to set an array
> to this method or similar?
>
> My idea is to get the name of the attributes from my case classes and put
> them directly, but I just can set the names in an array, list and so on.
>