我正在尝试将实时推文保存到cassandra,但是,Eclipse在这一行中显示了一个标记:
CassandraJavaUtil.javaFunctions(tweets).writerBuilder("Twitter","tweets", CassandraJavaUtil.mapToRow(tweets.class)).saveToCassandra();
即使我导入了所有软件包,Eclipse也无法识别mapToRow()和javaFunctions()。
我使用的是1.4.0 Cassandra连接器,以便与spark版本兼容。
我见过人们使用这种方法,
javaFunctions(, .class).saveToCassandra("java_api", "sales");
但文档说明它已被新版本弃用。
<dependencies>
<dependency>
<groupId>org.twitter4j</groupId>
<artifactId>twitter4j-core</artifactId>
<version>3.0.3</version>
</dependency>
<!--Spark Cassandra Connector -->
<dependency>
<groupId>com.datastax.spark</groupId>
<artifactId>spark-cassandra-connector_2.10</artifactId>
<version>1.4.0-M1</version>
</dependency>
<dependency>
<groupId>com.datastax.spark</groupId>
<artifactId>spark-cassandra-connector-java_2.10</artifactId>
<version>1.4.0-M1</version>
</dependency>
<!--Spark -->
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.10</artifactId>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-streaming_2.10</artifactId>
<version>1.4.0</version>
</dependency>
<!-- Twitter -->
<dependency>
<groupId>org.twitter4j</groupId>
<artifactId>twitter4j-stream</artifactId>
<version>3.0.3</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-streaming-twitter_2.10</artifactId>
<version>1.4.0</version>
</dependency>