Filter on CassandraJoinRDD

Viewed 45

I have applied a join on file and existing Cassandra table via joinWithCassandraTable. Now, I want to apply a filter on joinCassandraRDD. Here is the code and functionality which I have written for extraction of data:

var outrdd = sc.textFile("/usr/local/spark/bin/select_element/src/main/scala/file_small.txt")
  .map(_.toString).map(Tuple1(_))
  .joinWithCassandraTable(settings.keyspace, settings.table)
  .select("id", "listofitems")

Here "/usr/local/spark/bin/select_element/src/main/scala/file_small.txt" is the text file which is having a list of ids. Now, I have some elements in another list, say userlistofitems=["jas", "yuk"], I need to search 'userlistofitems' sublist from 'listofitems' column of joinCassandraRDD.

We have around 2Million ids where we have several user_lists for which we have to extract the data from Cassandra. We are using versions spark=2.4.4, scala=2.11.12, and spark-cassandra-connector=spark-cassandra-connector-2.4.2-3-gda70746.jar.

Any help is highly appreciated.

References Used: https://github.com/datastax/spark-cassandra-connector/blob/master/doc, https://www.youtube.com/watch?v=UsenTP029tM

0 Answers
Related