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

Fix NPE when checking is materialized hive view #18800

Closed

Conversation

jinyangli34
Copy link
Contributor

@jinyangli34 jinyangli34 commented Aug 24, 2023

Description

Fix NPE when Hive view's table_comment not exists

Additional context and related issues

Fixes #18799

Release notes

(x) Release notes are required, with the following suggested text:

# Hive
* Fix failure when reading Hive views. ({issue}`18799`)

@cla-bot cla-bot bot added the cla-signed label Aug 24, 2023
@github-actions github-actions bot added tests:hive hive Hive connector labels Aug 24, 2023
@@ -183,7 +183,7 @@ public static boolean isTrinoMaterializedView(String tableType, Map<String, Stri
// https://github.com/trinodb/trino/blame/ff4a1e31fb9cb49f1b960abfc16ad469e7126a64/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergMetadata.java#L898
return tableType.equals(VIRTUAL_VIEW.name()) &&
"true".equals(tableParameters.get(PRESTO_VIEW_FLAG)) &&
tableParameters.get(TABLE_COMMENT).equalsIgnoreCase(ICEBERG_MATERIALIZED_VIEW_COMMENT);
ICEBERG_MATERIALIZED_VIEW_COMMENT.equalsIgnoreCase(tableParameters.get(TABLE_COMMENT));
Copy link
Member

@ebyhr ebyhr Aug 24, 2023

Choose a reason for hiding this comment

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

Is it possible to add a test?

Don't we need to fix isTrinoView method as well?

@@ -183,7 +183,7 @@ public static boolean isTrinoMaterializedView(String tableType, Map<String, Stri
// https://github.com/trinodb/trino/blame/ff4a1e31fb9cb49f1b960abfc16ad469e7126a64/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergMetadata.java#L898
return tableType.equals(VIRTUAL_VIEW.name()) &&
"true".equals(tableParameters.get(PRESTO_VIEW_FLAG)) &&
tableParameters.get(TABLE_COMMENT).equalsIgnoreCase(ICEBERG_MATERIALIZED_VIEW_COMMENT);
ICEBERG_MATERIALIZED_VIEW_COMMENT.equalsIgnoreCase(tableParameters.get(TABLE_COMMENT));
Copy link
Contributor

Choose a reason for hiding this comment

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

@ebyhr
Copy link
Member

ebyhr commented Aug 31, 2023

Superseded by #18876. Thanks for your contribution.

@ebyhr ebyhr closed this Aug 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed hive Hive connector
Development

Successfully merging this pull request may close these issues.

NPE when reading hive view
3 participants