Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/apache-spark/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cassandra/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache spark Spark:每日阅读卡桑德拉的文章,保存到拼花地板上,如何只阅读新行?_Apache Spark_Cassandra_Spark Cassandra Connector - Fatal编程技术网

Apache spark Spark:每日阅读卡桑德拉的文章,保存到拼花地板上,如何只阅读新行?

Apache spark Spark:每日阅读卡桑德拉的文章,保存到拼花地板上,如何只阅读新行?,apache-spark,cassandra,spark-cassandra-connector,Apache Spark,Cassandra,Spark Cassandra Connector,我正试图用Spark构建一个ETL过程。我的目标是阅读 卡桑德拉表和保存到拼花文件 到目前为止,我所做的是使用Cassandra连接器(在pyspark中)从Cassandra读取整个表: 问题是我的数据增长很快,我想每天重复ETL过程,从Cassandra读取新添加的行,并将它们保存到新的拼花文件中 由于我的Cassandra表中没有排序,我将无法基于时间进行阅读,有没有办法从Spark侧进行阅读?只有当您有基于时间的第一个聚类列时,基于时间的有效过滤才是可能的,如下所示: create ta

我正试图用Spark构建一个ETL过程。我的目标是阅读 卡桑德拉表和保存到拼花文件

到目前为止,我所做的是使用Cassandra连接器(在pyspark中)从Cassandra读取整个表:

问题是我的数据增长很快,我想每天重复ETL过程,从Cassandra读取新添加的行,并将它们保存到新的拼花文件中


由于我的Cassandra表中没有排序,我将无法基于时间进行阅读,有没有办法从Spark侧进行阅读?

只有当您有基于时间的第一个聚类列时,基于时间的有效过滤才是可能的,如下所示:

create table test.test (
  pk1 <type>,
  pk2 <type>,
  cl1 timestamp,
  cl2 ...,
  primary key ((pk1, pk2), cl1, cl2));
将被有效地推送到Cassandra中,过滤将在服务器端进行,只检索必要的数据-这很容易通过解释进行检查-它应该生成类似的内容(推式过滤器表示为
*
):

//*过滤器((cl1#23>=155222894373000))
//+-*扫描org.apache.spark.sql.cassandra.CassandraSourceRelation[pk1#21,pk2#22L,cl1#23,…]
推式过滤器:[*大于或等于(CL12019-03-10 14:41:34.373)],
ReadSchema:struct
create table test.test (
  pk1 <type>,
  pk2 <type>,
  cl1 timestamp,
  cl2 ...,
  primary key ((pk1, pk2), cl1, cl2));
// *Filter ((cl1#23 >= 1552228894373000))
// +- *Scan org.apache.spark.sql.cassandra.CassandraSourceRelation [pk1#21,pk2#22L,cl1#23,...] 
PushedFilters: [*GreaterThanOrEqual(cl1,2019-03-10 14:41:34.373)], 
ReadSchema: struct<pk1:int,pk2:int,cl1:timestamp,...