首页 > 解决方案 > CassandraBeamIO 转换成 ROWS 的 Pcollection

问题描述

我正在尝试使用 apache beam CassandraIO 从 Cassandra db 读取数据,我的要求是从 cassandra db 创建 Pcollection of Rows,目前我的代码如下所示

PTransform<PBegin,PCollection<Row>>transform=CassandraIO.<Row>read()
   .withHosts(Collections.singletonList("127.0.0.1"))
   .withPort(9042)
   .withKeyspace("\"testDb\"")
   .withMapperFactoryFn(new CassandraRowMapper())
   .withQuery(q)
   .withTable("student")
   .withEntity(Row.class)
   .withCoder(SerializableCoder.of(Row.class));

任何帮助将不胜感激

标签: cassandraapache-beam-ioapache-beam

解决方案


推荐阅读