-2

I have a table in cassandra where it has a column of type 'text'. The value it holds is a json type of data.

So in each record this column will be having a value like.

{"a":"1", "b":"5", "c":"3", "d":"12"}

Similarly in next record it will have value something like

{"a":"12", "b":"52", "c":"13", "d":"3",}

So what i can say is this column is having a json value in each record.

My requirement is to retreive the values of "b" and "d" of each record using spark/sparksql.

Sri
  • 623
  • 3
  • 9
  • 22

1 Answers1

-1

After you read in the Cassandra table you can perform a User Defined Function (UDF) on the text column, and in that udf you can convert the string to a JSON object and return back the fields you require.

Saif Charaniya
  • 131
  • 1
  • 8