talatuyarer commented on code in PR #17859:
URL: https://github.com/apache/iceberg/pull/17859#discussion_r3899872777
##########
flink/v2.3/flink/src/main/java/org/apache/iceberg/flink/FlinkCatalog.java:
##########
@@ -683,6 +738,29 @@ static CatalogTable toCatalogTable(Table table) {
return toCatalogTableWithProps(table, table.properties());
}
+ private CatalogView toCatalogView(View view) {
+ SQLViewRepresentation sqlRepresentation = view.sqlFor(FLINK_DIALECT);
+ Preconditions.checkState(sqlRepresentation != null, "Cannot load SQL for
view %s", view.name());
+
+ ResolvedSchema resolvedSchema =
FlinkSchemaUtil.toResolvedSchema(view.schema());
+ org.apache.flink.table.api.Schema schema =
+
org.apache.flink.table.api.Schema.newBuilder().fromResolvedSchema(resolvedSchema).build();
+
+ Map<String, String> options = Maps.newHashMap(view.properties());
+ String comment = options.remove(ViewProperties.COMMENT);
+
+ ViewVersion currentVersion = view.currentVersion();
+ String defaultCatalog =
+ currentVersion.defaultCatalog() != null ?
currentVersion.defaultCatalog() : getName();
+ options.put(DEFAULT_CATALOG_OPTION, defaultCatalog);
+ options.put(DEFAULT_NAMESPACE_OPTION,
currentVersion.defaultNamespace().toString());
+
+ // both original and expanded query hold the stored SQL: Flink expands the
query itself,
+ // resolving unqualified references against the view's own catalog and
database
+ return CatalogView.of(
+ schema, comment, sqlRepresentation.sql(), sqlRepresentation.sql(),
options);
Review Comment:
Correct, they're resolution context for references inside the view SQL, not
attributes of the view itself, and Flink's planner doesn't consume them. It
resolves unqualified references against the view's own catalog and database.
They were meant as informational output only, and the `getName()` fallback
could even surface a value that isn't actually in the stored metadata. Removed
both options; the CatalogView options
now carry only the Iceberg view properties.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]