Spark Full Rdd joinWithCassandraTable java.lang.IllegalArgumentException:要求失败:无效的行大小:而不是

Spark Full Rdd joinWithCassandraTable java.lang.IllegalArgumentException: requirement failed: Invalid row size: instead of

这是我的示例代码

# 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)
    }

您需要在左 JoinWithCassandraTable 后立即使用 .on(SomeColumns("custId"))...

我有 the blog post on the efficient join with Cadsandra,它也描述了 RDD API...