-
Notifications
You must be signed in to change notification settings - Fork 415
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#6382] feat(iceberg): Make Gravitino Iceberg REST server keep compatibility with Trino #6396
base: main
Are you sure you want to change the base?
Conversation
@jerryshao @theoryxu @diqiu50 PTAL. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
// Trino Analyzer try to get view from Iceberg catalog, return NoSuchViewException to keep | ||
// the compatibility with Trino. | ||
if (!(catalog instanceof ViewCatalog)) { | ||
throw new NoSuchViewException("Catalog %s doesn't support view", catalog.name()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it better to throw an unsupported exception here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the side of Gravitino, it's reasonable to throw unsupported exception
but this will cause Trino query failed, because it will try to get view from Iceberg REST server in analyzer, please refer to https://github.com/trinodb/trino/blob/master/core/trino-main/src/main/java/io/trino/sql/analyzer/StatementAnalyzer.java#L2279
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why can't we fail the query if it is not supported? For example, if we write a query with some unsupported features, shall we fail the query, or doing some implicit conversion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will cause the simple SQL to fail in Trino like select * from xx
. The latest Trino code adds a configuration to enable compatibility with REST server that does not support view operations. But for the old trino releases, it couldn't work with Gravitino. This PR moves the compatibility work from client to server, I agree that this is a workaround solution, is more general solution is #6395 but it benefits the cooperation with Trino and Gravitino IRS.
@@ -228,10 +234,18 @@ public void renameView(RenameTableRequest request) { | |||
} | |||
|
|||
public boolean viewExists(TableIdentifier viewIdentifier) { | |||
if (!(catalog instanceof ViewCatalog)) { | |||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Though I don't know the behavior of Trino, from my feeling, it is better to throw an unsupported exception to let user clearly know the problem, rather than return false
.
false
can have different meaning, like ViewCatalog
is supported but this view is not existed. If we blindly return false
, how do we differentiate whether it is not supported or not existed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The purpose of the change is to keep consistent with loadView
, if the catalog doesn't support the view operation, loadView will throw NoSuchViewException
which means view not exists. Yes, this is something odd.
Hi @jackye1995 , what is your opinion on this? Trino latest master already fixed this, doing a such workaround is to be compatible with the old version of Trino, but I think this is a Trino problem, doing such a workaround on the REST server side seems a little awkward to me. WDYT? |
@jerryshao How about adding a flag to enable the compatibility action with Trino? cc @mchades |
trinodb/trino#24815 add |
What changes were proposed in this pull request?
To keep compatible with Trino, for the catalog backend which doesn't support view operation:
NoSuchViewException
notUnsupportedOperationException
for load view.Why are the changes needed?
Fix: #6382
Does this PR introduce any user-facing change?
no
How was this patch tested?
test basic SQL with Trino and Gravitino Iceberg REST server