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
Add listMaterializedViews and getMaterializedViews SPI #8113
Conversation
@raunaqmorarka i am adding more tests, inclduding a bit of information_schema coverage for MVs in #8117 |
Looked at it, since i've tested similar cases in this PR, I think it should result in the |
@findepi I've rebased this to master and added changes to BaseConnectorTest#testMaterializedView |
core/trino-main/src/main/java/io/trino/metadata/MetadataManager.java
Outdated
Show resolved
Hide resolved
@@ -353,7 +353,10 @@ public static boolean isTablesEnumeratingTable(InformationSchemaTable table) | |||
.flatMap(prefix -> tables.get().stream() | |||
.filter(this::isLowerCase) | |||
.map(table -> new QualifiedObjectName(catalogName, prefix.getSchemaName().get(), table))) | |||
.filter(objectName -> !isColumnsEnumeratingTable(informationSchemaTable) || metadata.getTableHandle(session, objectName).isPresent() || metadata.getView(session, objectName).isPresent()) | |||
.filter(objectName -> !isColumnsEnumeratingTable(informationSchemaTable) || |
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.
would it be possible to add test to TestInformationSchemaConnector
or TestInformationSchemaMetadata
?
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 is covered by BCT column listing tests
...ino-main/src/main/java/io/trino/connector/informationschema/InformationSchemaPageSource.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/connector/system/jdbc/TableJdbcTable.java
Outdated
Show resolved
Hide resolved
core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorMetadata.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/metadata/MetadataManager.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/connector/system/jdbc/ColumnJdbcTable.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/sql/rewrite/ShowQueriesRewrite.java
Outdated
Show resolved
Hide resolved
plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergMaterializedViews.java
Outdated
Show resolved
Hide resolved
testing/trino-testing/src/main/java/io/trino/testing/BaseConnectorTest.java
Outdated
Show resolved
Hide resolved
testing/trino-testing/src/main/java/io/trino/testing/BaseConnectorTest.java
Outdated
Show resolved
Hide resolved
be5afc5
to
b99061e
Compare
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.
% small comments.
Should #8153 land first?
plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergMetadata.java
Show resolved
Hide resolved
testing/trino-testing/src/main/java/io/trino/testing/BaseConnectorTest.java
Outdated
Show resolved
Hide resolved
please rebase on top of #8153 |
done |
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 % minor comments
...ino-main/src/main/java/io/trino/connector/informationschema/InformationSchemaPageSource.java
Outdated
Show resolved
Hide resolved
testing/trino-testing/src/main/java/io/trino/testing/BaseConnectorTest.java
Outdated
Show resolved
Hide resolved
Added tests for information_schema.tables and system.jdbc.tables
Fixed and added tests for DESCRIBE, SHOW COLUMNS, information_schema.columns and system.jdbc.columns
@@ -280,6 +280,7 @@ private void addTablesRecords(QualifiedTablePrefix prefix) | |||
{ | |||
Set<SchemaTableName> tables = listTables(session, metadata, accessControl, prefix); | |||
Set<SchemaTableName> views = listViews(session, metadata, accessControl, prefix); | |||
// TODO (https://github.com/trinodb/trino/issues/8207) define a type for materialized views |
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.
nit: this should be separate commit
Used listMaterializedViews to list MV names for information_schema.tables, system.jdbc.tables and SHOW TABLES
Used getMaterializedViews to list MV columns in information_schema.columns, system.jdbc.columns and SHOW COLUMNS
Fixed DESCRIBE, SHOW COLUMNS, information_schema.columns, system.jdbc.columns for MVs in Iceberg.
Table type used for MVs in information_schema.tables is left unchanged as BASE TABLE.
MVs are not listed in information_schema.views.
getMaterializedViews can be used in future to introduce information_schema.trino_materialized_views or system.metadata.materialized_views for showing detailed information about materialized view definitions.