- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用以下方法过滤巨大的 Cassandra 表的一小部分:
val snapshotsFiltered = sc.parallelize(startDate to endDate).map(TableKey(_2)).joinWithCassandraTable("listener","snapshots_test_b")
case class TableKey(imei: String, created: Long, when: Long)
[error] /home/ubuntu/scala/test/test.scala:61: not enough arguments for method apply: (imei: String, created: Long)test.TableKey in object TableKey. [error] Unspecified value parameter created. [error] val snapshotsFiltered = sc.parallelize(startDate to endDate).map(TableKey(_2)).joinWithCassandraTable("listener","snapshots_test_b") [error] ^ [error] one error found [error] (compile:compile) Compilation failed
val snapshotsFiltered = sc.parallelize(startDate to endDate).map(TableKey("*",_,startDate)).joinWithCassandraTable("listener","snapshots_test_c")
最佳答案
错误告诉您类 TableKey
需要 3 个组件来初始化,但只传递了一个参数。这是 Scala 编译错误,与 C* 或 Spark 无关。
val snapshotsFiltered = sc.parallelize(startDate to endDate)
.map(TableKey(_2)) /// Table Key does not have a single element constructor so this will fail
.joinWithCassandraTable("listener","snapshots_test_b")
partition key
确定特定行所在的位置。因此,只有在您了解整个
partition key
的情况下才能有效地提取数据。所以只传递其中的一部分没有值(value)。
partition key
值,因此它可以有效地完成它的工作。如果您只有
parition key
的一部分您将需要执行全表扫描并使用 Spark 进行过滤。
clustering column
进行过滤您可以通过按下
where
来实现。 C* 的子句,例如
sc.cassandraTable("ks","test").where("clustering_key > someValue")
关于scala - Spark joinWithCassandraTable() 映射多个分区键错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31773477/
我目前正在使用这个堆栈: Cassandra 2.2(多节点) Spark/Streaming 1.4.1 Spark-Cassandra-连接器 1.4.0-M3 我有这个 DStream[Ids]
我正在尝试使用以下方法过滤巨大的 Cassandra 表的一小部分: val snapshotsFiltered = sc.parallelize(startDate to endDate).map(
我正在使用 Spark 1.2.1 和 spark-cassandra-connector : //join with cassandra val rdd = some_array.map(x =>
我正在尝试使用以下方法对巨大的 C* 表的一小部分进行过滤: val snapshotsFiltered = sc.parallelize(startDate to endDate).map(
我希望在 RDD 和 cassandra 表上进行连接,它们的名称与相同的键不同 前(简化): case class User(id : String, name : String) 和 case c
我目前正在尝试将 spark 数据框加入 cassandra 表。 遗憾的是,我们无法立即升级到新的 Datastax 连接器 2.5.0 并使用直接连接 所以我正在尝试使用现有的 Rdd 方法 jo
我是一名优秀的程序员,十分优秀!