gpt4 book ai didi

java - 获取异常 java.util.NoSuchElementException : key not found: 'text' in spark-cassandra-connector

转载 作者:搜寻专家 更新时间:2023-11-01 03:56:34 27 4
gpt4 key购买 nike

我想将 spark RDD 中的数据保存到 cassandra 表中。我正在使用来自 java 的 spark-cassandra-connector https://github.com/datastax/spark-cassandra-connector

按照文档保存的代码

rddJavaFunctions.writerBuilder("populartweets", "stream_tag_count",
CassandraJavaUtil.mapToRow(Tag.class)).withColumnSelector(CassandraJavaUtil.someColumns("tag","count"))
.saveToCassandra();

在这个操作之后我得到了错误

    New Cassandra host /127.0.0.1:9042 added
15/12/16 10:18:06 INFO CassandraConnector: Connected to Cassandra cluster: Test Cluster
Exception in thread "main" java.util.NoSuchElementException: key not found: 'text'
at scala.collection.MapLike$class.default(MapLike.scala:228)
at scala.collection.AbstractMap.default(Map.scala:58)
at scala.collection.MapLike$class.apply(MapLike.scala:141)
at scala.collection.AbstractMap.apply(Map.scala:58)
at com.datastax.spark.connector.types.ColumnType$.fromDriverType(ColumnType.scala:81)
at com.datastax.spark.connector.cql.ColumnDef$.apply(Schema.scala:117)
at com.datastax.spark.connector.cql.Schema$$anonfun$com$datastax$spark$connector$cql$Schema$$fetchPartitionKey$1.apply(Schema.scala:199)
at com.datastax.spark.connector.cql.Schema$$anonfun$com$datastax$spark$connector$cql$Schema$$fetchPartitionKey$1.apply(Schema.scala:198)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
at scala.collection.Iterator$class.foreach(Iterator.scala:727)
at scala.collection.AbstractIterator.foreach(Iterator.scala:1157)
at scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
at scala.collection.AbstractIterable.foreach(Iterable.scala:54)

我正在使用 spark 1.5.2

最佳答案

此问题已针对 Cassandra 3.x 解决。使用 spark-connector 1.5.0-RC1(截至今天最新)。

关于java - 获取异常 java.util.NoSuchElementException : key not found: 'text' in spark-cassandra-connector,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34304179/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com