-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Iceberg View Rest Catalog support #19818
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,7 @@ public enum IcebergErrorCode | |
ICEBERG_WRITER_CLOSE_ERROR(14, EXTERNAL), | ||
ICEBERG_MISSING_METADATA(15, EXTERNAL), | ||
ICEBERG_WRITER_DATA_ERROR(16, EXTERNAL), | ||
ICEBERG_UNSUPPORTED_VIEW_DIALECT(17, EXTERNAL) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice, I like making this Iceberg specific |
||
/**/; | ||
|
||
private final ErrorCode errorCode; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -218,6 +218,7 @@ | |
import static io.trino.plugin.iceberg.IcebergErrorCode.ICEBERG_FILESYSTEM_ERROR; | ||
import static io.trino.plugin.iceberg.IcebergErrorCode.ICEBERG_INVALID_METADATA; | ||
import static io.trino.plugin.iceberg.IcebergErrorCode.ICEBERG_MISSING_METADATA; | ||
import static io.trino.plugin.iceberg.IcebergErrorCode.ICEBERG_UNSUPPORTED_VIEW_DIALECT; | ||
import static io.trino.plugin.iceberg.IcebergMetadataColumn.FILE_MODIFIED_TIME; | ||
import static io.trino.plugin.iceberg.IcebergMetadataColumn.FILE_PATH; | ||
import static io.trino.plugin.iceberg.IcebergMetadataColumn.isMetadataColumnId; | ||
|
@@ -2504,6 +2505,20 @@ public Map<SchemaTableName, ConnectorViewDefinition> getViews(ConnectorSession s | |
return catalog.getViews(session, schemaName); | ||
} | ||
|
||
@Override | ||
public boolean isView(ConnectorSession session, SchemaTableName viewName) | ||
{ | ||
try { | ||
return catalog.getView(session, viewName).isPresent(); | ||
} | ||
catch (TrinoException e) { | ||
if (e.getErrorCode() == ICEBERG_UNSUPPORTED_VIEW_DIALECT.toErrorCode()) { | ||
return true; | ||
} | ||
Comment on lines
+2515
to
+2517
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The reason for the Iceberg specific error code is so that we can handle multiple dialects properly in the isView logic and distinguish it from other errors. We can just catch this particular code and return true, and other catalogs in the future can just do what the rest catalog does and it should just work. Another benefit of this is that we don't need to plumb isView all the way down into |
||
throw e; | ||
} | ||
} | ||
|
||
@Override | ||
public Optional<ConnectorViewDefinition> getView(ConnectorSession session, SchemaTableName viewName) | ||
{ | ||
|
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 default implementation of connector metadata#getView will preserve the existing behavior for other connectors by just doing getView().isPresent. IcebergMetadata overrides this implementation so we can still return true in the case of multiple dialects.