Spark scala cassandra -
please see below code , let me know doing wrong?
using:
dse version - 5.1.0
connected test cluster @ 172.31.16.45:9042. [cqlsh 5.0.1 | cassandra 3.10.0.1652 | dse 5.1.0 | cql spec 3.4.4 | native protocol v4] use help.
thanks
cassandra table : cqlsh:tdata> select * map; sno | name -----+------ 1 | 1 2 | 2
-------------------------------------------
scala> :showschema tdata ======================================== keyspace: tdata ======================================== table: map ---------------------------------------- - sno : int (partition key column) - name : string
scala> val rdd = sc.cassandratable("tdata", "map")
scala> rdd.foreach(println)
i not getting here? not error.
you have hit common spark issue. println
code being executed on remote executor
jvms. means printout stdout
of executor
jvm process. if want bring data driver
jvm before printing need collect
call.
rdd .collect //change rdd local collection .foreach(println)
Comments
Post a Comment