lindong28 commented on code in PR #22262:
URL: https://github.com/apache/flink/pull/22262#discussion_r1148724109
##########
flink-table/flink-table-api-bridge-base/src/main/java/org/apache/flink/table/operations/ExternalQueryOperation.java:
##########
@@ -107,4 +107,18 @@ public ResolvedSchema getResolvedSchema() {
public <T> T accept(QueryOperationVisitor<T> visitor) {
return visitor.visit(this);
}
+
+ public boolean equalsRegardlessOfIdentifier(Object obj) {
Review Comment:
It seems unnecessary to compare fields such as `isTopLevelRecord`. It might
be simpler to do the following in `toDataStream()`:
```
public DataStream<Row> toDataStream(Table table) {
Preconditions.checkNotNull(table, "Table must not be null.");
// include all columns of the query (incl. metadata and computed columns)
DataType sourceType = table.getResolvedSchema().toSourceRowDataType();
if (!(table.getQueryOperation() instanceof ExternalQueryOperation)) {
return toDataStream(table, sourceType);
}
DataTypeFactory dataTypeFactory =
getCatalogManager().getDataTypeFactory();
SchemaResolver schemaResolver = getCatalogManager().getSchemaResolver();
ExternalQueryOperation<?> queryOperation =
(ExternalQueryOperation<?>) table.getQueryOperation();
DataStream<?> dataStream = queryOperation.getDataStream();
SchemaTranslator.ConsumingResult consumingResult =
SchemaTranslator.createConsumingResult(dataTypeFactory,
dataStream.getType(), null);
ResolvedSchema defaultSchema =
consumingResult.getSchema().resolve(schemaResolver);
if (queryOperation.getChangelogMode().equals(ChangelogMode.insertOnly())
&& table.getResolvedSchema().equals(defaultSchema)
&& consumingResult.getProjections() == null
&& dataStream.getType() instanceof RowTypeInfo) {
return (DataStream<Row>) dataStream;
}
return toDataStream(table, sourceType);
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]