Skip to content
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

information_schema.views fixes for materialized views #17444

Merged
merged 4 commits into from
May 15, 2023
Merged

Conversation

findepi
Copy link
Member

@findepi findepi commented May 10, 2023

No description provided.

@github-actions github-actions bot added hive Hive connector iceberg Iceberg connector tests:hive labels May 10, 2023
@findepi
Copy link
Member Author

findepi commented May 11, 2023

(just rebased)

@@ -337,14 +337,6 @@ public void testShowCreateTable()
")\\E");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Despite a materialized view having VIEW
table_type in information_schema.tables, they are not supposed to
show up in views.

So where they should appear? Is this part of SQL standard?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commit message is wrong, will fix it.

we have system.metadata.materialized_views for them

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this part of SQL standard?

afaik MVs are extension

findepi added 3 commits May 12, 2023 09:16
The test expected that materialized views show up in
`information_schama.views`. Materialized views are reported with
`table_type=BASE TABLE` in `information_schema.tables` and are not
supposed to show up in `information_schema.views`.
Test system.metadata.materialized_view when testing metadata listings
(eg information_schema.views).
@findepi
Copy link
Member Author

findepi commented May 12, 2023

rebased to be on top of #17127 and fixed first commit message per #17444 (comment)

@findepi findepi force-pushed the findepi/mvlist branch 2 times, most recently from 18b5a1a to 1b6d88e Compare May 12, 2023 07:24
@findepi findepi requested review from kokosing and losipiuk May 12, 2023 07:25
Fix value in `table_type` column of `information_schema.tables` for

- materialized views when Iceberg connector is backed by Glue catalog
- materialized views in Hive connector (when
  `HiveMaterializedViewMetadata` extension is used).
Copy link
Contributor

@huberty89 huberty89 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@findepi
Copy link
Member Author

findepi commented May 15, 2023

CI #16277

Copy link
Member

@kokosing kokosing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comments

@@ -556,6 +556,20 @@ public void testMaterializedView()
"FROM\n" +
" nation");

// information_schema.tables (no filtering on table_name so that ConnectorMetadata.listViews is exercised)
assertThat(query("SELECT table_name, table_type FROM information_schema.tables WHERE table_schema = '" + schemaName + "'"))
.containsAll("VALUES (VARCHAR '" + viewName + "', VARCHAR 'BASE TABLE')");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why view is marked as base table?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dictator's decision.

.returnsEmptyResult();

// materialized view-specific listings
assertThat(query("SELECT name FROM system.metadata.materialized_views WHERE catalog_name = '" + catalogName + "' AND schema_name = '" + schemaName + "'"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are there any other columns that we should test?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i chose name only because i focus on the listing ("is or isn't" there). we can revisit as needed

.containsAll("VALUES (VARCHAR '" + viewName + "', VARCHAR 'BASE TABLE')");

// information_schema.views
assertThat(computeActual("SELECT table_name FROM information_schema.views WHERE table_schema = '" + schemaName + "'").getOnlyColumnAsSet())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are there any other columns that we should test?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as above

@sopel39 sopel39 removed their request for review May 15, 2023 13:11
@findepi findepi merged commit fd14f9f into master May 15, 2023
@findepi findepi deleted the findepi/mvlist branch May 15, 2023 14:36
@github-actions github-actions bot added this to the 418 milestone May 15, 2023
@colebow
Copy link
Member

colebow commented May 17, 2023

Does this need release notes? @findepi

@findepi findepi added the no-release-notes This pull request does not require release notes entry label May 18, 2023
@findepi
Copy link
Member Author

findepi commented May 18, 2023

i don't think so, Cole

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed hive Hive connector iceberg Iceberg connector no-release-notes This pull request does not require release notes entry
Development

Successfully merging this pull request may close these issues.

5 participants