连接两个Pcollection时没有schema时无法调用getSchema

问题描述 投票:0回答:1

希望你一切都好。

我有两个 PCollection,我想应用 leftOuterJoin,但是当我执行此操作时,出现此错误,我不明白为什么:java.lang.IllegalStateException:没有模式时无法调用 getSchema

final PCollection<ClassA> classA = BigQueryReader.getClassA(pipeline, configuration.getBigQueryOptions());
final PCollection<ClassB> classB = BigQueryReader.getClassB(pipeline, configuration.getBigQueryOptions());

final PCollection<Row> join = classA
                .apply("Apply Join",
                        Join.<ClassA, ClassB>leftOuterJoin(classB).using("id1", "id2"));

有人可以帮助理解为什么会发生此错误。

非常感谢。

java google-cloud-platform google-cloud-dataflow apache-beam
1个回答
0
投票

您正在尝试使用模式转换。仅当涉及的所有 PCollection 都有关联的架构时,才能使用此类内置转换。

由于我只使用过 Python SDK,所以我无法告诉您如何在 Java 中定义 Beam 模式,但您可以查看编程指南了解语法/定义。

© www.soinside.com 2019 - 2024. All rights reserved.