Spark Full Rdd joinWithCassandraTable java.lang.IllegalArgumentException:要求失败:无效的行大小:而不是
Spark Full Rdd joinWithCassandraTable java.lang.IllegalArgumentException: requirement failed: Invalid row size: instead of
- 我目前正在尝试将 spark 数据帧连接到 cassandra table。
- 很遗憾,我们无法立即升级到新的 Datastax 连接器 2.5.0 并使用直接连接
- 所以我正在尝试使用现有的 joinWithCassandraTable
的 Rdd 方法
这是我的示例代码
# Cassandra Table Definition
custId: text PRIMARY KEY
custName: text
custAddress: text
val testDF = Seq(("event-01", "cust-01"), ("event-02", "cust-02")).toDF(("eventId", "custId"))
val resultRdd = testDF
.rdd
.leftJoinWithCassandraTable(
keyspaceName = "my_key_space",
tableName = "cust_table",
selectedColumns = AllColumns,
joinColumns = SomeColumns("custId")
)
.map { case (sparkRow, cassandraRow) =>
val resultStruct = cassandraRow
.map(r => Row.fromSeq(r.columnValues))
.orNull
Row.fromSeq(sparkRow.toSeq :+ resultStruct)
}
- 这会引发 java.lang.IllegalArgumentException:要求失败:行大小无效:2 而不是 1
- 如果我将
testDF
限制为只有 custId 列,那么这很好用。
- 我是不是哪里弄错了。我如何在 Full Rdd 上执行连接而不是仅使用键列
进行投影
您需要在左 JoinWithCassandraTable 后立即使用 .on(SomeColumns("custId"))
...
我有 the blog post on the efficient join with Cadsandra,它也描述了 RDD API...
- 我目前正在尝试将 spark 数据帧连接到 cassandra table。
- 很遗憾,我们无法立即升级到新的 Datastax 连接器 2.5.0 并使用直接连接
- 所以我正在尝试使用现有的 joinWithCassandraTable 的 Rdd 方法
这是我的示例代码
# Cassandra Table Definition
custId: text PRIMARY KEY
custName: text
custAddress: text
val testDF = Seq(("event-01", "cust-01"), ("event-02", "cust-02")).toDF(("eventId", "custId"))
val resultRdd = testDF
.rdd
.leftJoinWithCassandraTable(
keyspaceName = "my_key_space",
tableName = "cust_table",
selectedColumns = AllColumns,
joinColumns = SomeColumns("custId")
)
.map { case (sparkRow, cassandraRow) =>
val resultStruct = cassandraRow
.map(r => Row.fromSeq(r.columnValues))
.orNull
Row.fromSeq(sparkRow.toSeq :+ resultStruct)
}
- 这会引发 java.lang.IllegalArgumentException:要求失败:行大小无效:2 而不是 1
- 如果我将
testDF
限制为只有 custId 列,那么这很好用。 - 我是不是哪里弄错了。我如何在 Full Rdd 上执行连接而不是仅使用键列 进行投影
您需要在左 JoinWithCassandraTable 后立即使用 .on(SomeColumns("custId"))
...
我有 the blog post on the efficient join with Cadsandra,它也描述了 RDD API...