我有以下卡桑德拉表用法:分区键检索与joinWithCassandraTable
CREATE TABLE listener.snapshots_geohash
(
created_date text, -- date when record have come to the system
geo_part text, -- few signs of geo hash - just for partitioning
when timestamp, -- record creation date
device_id text, -- id of device produced json data (see snapshot column)
snapshot text, -- json data, should be aggregated by spark
PRIMARY KEY ((created_date, geo_part), when, device_id)
)
每天早上聚合应用程序应该加载前一天和快照列总JSON数据。聚合将通过geohash对数据进行分组,这就是为什么它的部分被选为分区键的一部分。
我知道使用joinWithCassandraTable加载Cassandra中的数据是有效的 - 但为此,我必须从(created_date,geo_part)对中构建RDD。尽管我知道created_date值,但我无法列出geo_part值 - 因为它只是geohash的一部分,并且其值不连续。所以我有办法运行select distinct created_date, geo_part from ks.snapshots
并从其结果创建RDD。问题是如何使用spark 2.0.2和cassandra-connector 2.0.0-M3运行此选择,或者可能有其他方法?