Home > other >  How to update from the spark Cassandra data table?
How to update from the spark Cassandra data table?

Time:09-17

I think from the calculation results of spark Cassandra, but must use the update statement, which the great spirit to guide how to use the update statement to update the table?

In this example: saveToCassandra place can have the update method?

Lines. The map (x=& gt; (x) _1, x. _7), (x) _5, x. _6)))
ReduceByKey ((x, y)=& gt; (x) _1 + y) _1, x. _2 + y. _2))
The map (x=& gt; (x) _1) _1, x. _1, _2, x. _2. _1, x. _2) _2))
Logt_stats casdemo saveToCassandra (" ", "", SomeColumns (" accesstime", "name", "count", "bytes"))

CodePudding user response:

foreachPartition

CodePudding user response:

I do not know the building Lord specific application scenario,
Direct saveToCassandra, consistent data contains the original table's primary key insert is updated,
If the original table as
Id, name, age
Li 18 1
2 Wang 20
PrimaryKey (id)

1 Zhang, 22
Direct insertion somecolumn (id, name, age)
Is updated to:
Id, name, age
1 Zhang, 22
2 Wang 20
PrimaryKey (id)
  • Related