Hi list,

I'm using Cassandra with only 2 fields (id, json).
I'm using Spark to query the json. Until now I can use a json file and
query that file, but Cassandra and RDDs of the json field not yet.

sc = spark.sparkContext
path = "/home/me/red50k.json"
redirectsDF = spark.read.json(path)
redirectsDF.createOrReplaceTempView("red")
result = spark.sql("select idv from red where idv = '9'")
result.show()

val conf = new SparkConf(true)
    .set("spark.cassandra.connection.host", "192.168.1.74")
    .set("spark.cassandra.auth.username", "cassandra")
    .set("spark.cassandra.auth.password", "cassandra")
val sc = new SparkContext("spark://192.168.1.74:7077", "test", conf)
val table = sc.cassandraTable("test", "ttable")
println(ttable.count)

Some help please to join both things. Scala or Python code for me it's ok.
Thanks in advance.
Cheers.


---------------------------------------------------------------------
To unsubscribe e-mail: user-unsubscr...@spark.apache.org

Reply via email to