amogh-jahagirdar commented on code in PR #9247: URL: https://github.com/apache/iceberg/pull/9247#discussion_r1428849085
########## core/src/main/java/org/apache/iceberg/view/BaseView.java: ########## @@ -103,4 +104,28 @@ public UpdateLocation updateLocation() { public UUID uuid() { return UUID.fromString(ops.current().uuid()); } + + /** + * This implementation of sqlFor will resolve what is considered the "closest" dialect. If an + * exact match is found, then that is returned. Otherwise, the first representation would be + * returned. If no SQL representation is found, null is returned. + */ + @Override + public SQLViewRepresentation sqlFor(String dialect) { + Preconditions.checkArgument(dialect != null, "Invalid dialect: null"); + Preconditions.checkArgument(!dialect.isEmpty(), "Invalid dialect: (empty string)"); + SQLViewRepresentation closest = null; + for (ViewRepresentation representation : currentVersion().representations()) { + if (representation instanceof SQLViewRepresentation) { + SQLViewRepresentation sqlViewRepresentation = (SQLViewRepresentation) representation; + if (sqlViewRepresentation.dialect().equals(dialect)) { Review Comment: But yes I think the API should be case insensitive (in practice it won't really matter I think because engines would just read and write the view through a constant but it's helpful from an API perspective if someone wants to create the view from say a Python script which doesn't necessarily know the exact constant). The API should still return the same representation -- 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: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org