Java 如何使用Apache Beam DSL API?
我正在尝试从中实现DSLAPI示例。我正在使用最新版本的ApacheBeam库(2.4.0) 我正在运行的代码与文档中的代码相同:Java 如何使用Apache Beam DSL API?,java,google-cloud-dataflow,apache-beam,apache-calcite,Java,Google Cloud Dataflow,Apache Beam,Apache Calcite,我正在尝试从中实现DSLAPI示例。我正在使用最新版本的ApacheBeam库(2.4.0) 我正在运行的代码与文档中的代码相同: @Rule public final transient TestPipeline p = TestPipeline.create(); @Test public void dslTest() { RowType appType = RowSqlType .builder() .withIntegerFiel
@Rule
public final transient TestPipeline p = TestPipeline.create();
@Test
public void dslTest() {
RowType appType = RowSqlType
.builder()
.withIntegerField("appId")
.withVarcharField("description")
.withTimestampField("rowtime")
.build();
// Create a concrete row with that type.
Row row = Row.withRowType(appType)
.addValues(1, "Some cool app", new Date())
.build();
// Create a source PCollection containing only that row
PCollection<Row> testApps = PBegin
.in(p)
.apply(Create
.of(row)
.withCoder(appType.getRowCoder()));
PCollection<Row> filteredNames = testApps.apply(
BeamSql.query(
"SELECT appId, description, rowtime "
+ "FROM PCOLLECTION "
+ "WHERE appId=1"));
}
运行此测试的正确方法是什么,或者这是一个错误,dsl API不起作用?这似乎是一个已知的问题,规划器中有一个Beam无法满足的断言,请参见此。它的修复目前还没有准备好 当前的解决方法是禁用断言,具体取决于生成系统:
- 如果您使用的是gradle,那么您将有如下内容: test { jvmArgs "-da" } <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <argLine>-da</argLine> 试验{ jvmArgs“-da” }
- 如果您使用的是maven,那么您将有如下内容: test { jvmArgs "-da" } <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <argLine>-da</argLine> org.apache.maven.plugins maven surefire插件 -da