2

I have two columns in cassandra of type bigint.

Using gocql I want to retrieve values from these columns using the IN clause.

My query looks something like this -

QUERY := select column1,column2,column3 from tableName
  where id1 in (?)
  and id2 in (?)
  ALLOW FILTERING;

And I am calling this query from my code like -

query := db.CassandraSession.Query(QUERY, Ids1, Ids2)

where Ids1 and Ids2 are two slices of type int64 (i.e. []int64)

when executing this query using

iter := query.Iter()
for iter.Scan(.....
)
err := iter.Close()

I get error can not marshal []int64 into bigint

Can someone help me in resolving this?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459

1 Answers1

0

I suspect the issue lies within your code but I have to admit I'm only guessing because of the lack of information in your post.

You'll need to provide additional information to make it easy for others to help you. At the very least, you should provide details to replicate the problem:

  • minimal sample table schema
  • minimal sample code

As a side note but a very important point to make is that it's almost always bad practice to use ALLOW FILTERING in your application queries and we definitely don't recommend using it in production because its performance can be very unpredictable.

Similarly, try to avoid using the IN() operator where possible. It's OK to use for 2 or 3 elements but any more than that can be detrimental to the performance of your app and cluster.

In most cases, the use of ALLOW FILTERING or the IN() operator indicates that you got the data model wrong and you need to redesign your tables. Cheers!

Erick Ramirez
  • 13,964
  • 1
  • 18
  • 23