Skip to content

Handle missing StorageDescriptor in Hive Glue materialized views#17276

Closed
grantatspothero wants to merge 3 commits intotrinodb:masterfrom
grantatspothero:gn/fixGlueToTrinoConverterMaterializedViewHandling
Closed

Handle missing StorageDescriptor in Hive Glue materialized views#17276
grantatspothero wants to merge 3 commits intotrinodb:masterfrom
grantatspothero:gn/fixGlueToTrinoConverterMaterializedViewHandling

Conversation

@grantatspothero
Copy link
Copy Markdown
Contributor

Description

Fixes: #17274

Additional context and related issues

Related PR that fixed some of the issues with null storage descriptors with glue, but did not handle materialized views: https://github.com/trinodb/trino/pull/11092/files

Release notes

( ) This is not user-visible or docs only and no release notes are required.
( ) Release notes are required, please propose a release note for me.
(x) Release notes are required, with the following suggested text:

# Section
* Allow the Hive Glue Metastore to redirect Iceberg Materialized Views which are missing a StorageDescriptor

@grantatspothero grantatspothero force-pushed the gn/fixGlueToTrinoConverterMaterializedViewHandling branch from a018848 to 309e8f7 Compare April 27, 2023 21:47
@github-actions github-actions bot added hive Hive connector tests:hive labels Apr 28, 2023
@grantatspothero grantatspothero force-pushed the gn/fixGlueToTrinoConverterMaterializedViewHandling branch 2 times, most recently from 0ebce8b to 26948f5 Compare April 28, 2023 18:15
@github-actions github-actions bot added the iceberg Iceberg connector label Apr 28, 2023
@grantatspothero grantatspothero force-pushed the gn/fixGlueToTrinoConverterMaterializedViewHandling branch from 26948f5 to 9e5876f Compare May 1, 2023 16:33
@github-actions github-actions bot added the delta-lake Delta Lake connector label May 1, 2023
@grantatspothero grantatspothero force-pushed the gn/fixGlueToTrinoConverterMaterializedViewHandling branch from 9e5876f to 10867ab Compare May 1, 2023 18:32
@grantatspothero grantatspothero force-pushed the gn/fixGlueToTrinoConverterMaterializedViewHandling branch 3 times, most recently from 127fb6c to 17f2300 Compare May 5, 2023 17:45
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

isHiveOrPrestoView(mv) // returns false
isPrestoView(mv) // returns true

however, per it's name, isHiveOrPrestoView should be superset of isPrestoView, right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Makes sense from a consistency standpoint.

Removed isHiveOrPrestoView and the behavior can be replicated with isViewOrMaterializedView(view) && !isTrinoMaterializedView(view).

I think this makes sense from an API standpoint. I do not think a method like isView should exist because it is unclear if view refers to materialized or not.

@findepi
Copy link
Copy Markdown
Member

findepi commented May 8, 2023

This PR this good in a way it approaches to untangle technical debt around isXxxView methods.
However, the increased ambitions mean the bug fix is delayed, so I created slimmed down version of this: #17383.

@grantatspothero grantatspothero force-pushed the gn/fixGlueToTrinoConverterMaterializedViewHandling branch from 17f2300 to 78b9dc8 Compare May 8, 2023 21:29
@grantatspothero
Copy link
Copy Markdown
Contributor Author

grantatspothero commented May 8, 2023

Almost there! Fixed final comment and added one rename commit for isPrestoView -> isTrinoView. I think the API makes a lot more sense now (isTrinoView, isTrinoMaterializedView, isViewOrMaterializedView)

Please take another look.

@grantatspothero grantatspothero force-pushed the gn/fixGlueToTrinoConverterMaterializedViewHandling branch 2 times, most recently from 16f5623 to a43a1ba Compare May 8, 2023 21:41
renamed for consistency with the rest of the isView methods
@grantatspothero grantatspothero force-pushed the gn/fixGlueToTrinoConverterMaterializedViewHandling branch from a43a1ba to e8a44d1 Compare May 8, 2023 21:53
import static io.trino.plugin.deltalake.DeltaLakeMetadata.PATH_PROPERTY;
import static io.trino.plugin.hive.TableType.MANAGED_TABLE;
import static io.trino.plugin.hive.ViewReaderUtil.isHiveOrPrestoView;
import static io.trino.plugin.hive.ViewReaderUtil.isViewOrMaterializedView;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Remove isHiveOrPrestoView and replace usages with

This ^ is the commit title. Looks truncated. See https://github.com/trinodb/trino/blob/master/.github/DEVELOPMENT.md#format-git-commit-messages

public static boolean isTrinoMaterializedView(Map<String, String> tableParameters)
{
return isPrestoView(tableParameters) && tableParameters.get(TABLE_COMMENT).equalsIgnoreCase(ICEBERG_MATERIALIZED_VIEW_COMMENT);
return isTrinoView(tableParameters) && tableParameters.get(TABLE_COMMENT).equalsIgnoreCase(ICEBERG_MATERIALIZED_VIEW_COMMENT);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

is it obvious that isTrinoView can be true also for materialized view?

to me, a materialized view is a separate type, not a subclass of view. especially given that it has separate handling in ConnectorMetadata

that's perhaps why you introduced isViewOrMaterializedView method -- you didn't call it isView, as would be sufficient if materialized views were always treated as a subcategory of views

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

i am doing this in #18570

if (isIcebergTable(tableParameters) || (sd == null && isDeltaLakeTable(tableParameters))) {
if (isIcebergTable(tableParameters) ||
(sd == null && isDeltaLakeTable(tableParameters)) ||
(sd == null && isTrinoMaterializedView(firstNonNull(glueTable.getParameters(), Map.of())))) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

you already have tableParameters

(will address this in #17383)

@github-actions
Copy link
Copy Markdown

This pull request has gone a while without any activity. Tagging the Trino developer relations team: @bitsondatadev @colebow @mosabua

@github-actions github-actions bot added the stale label Jan 16, 2024
@mosabua
Copy link
Copy Markdown
Member

mosabua commented Jan 16, 2024

👋 @grantatspothero @findepi - this PR has become inactive. If you're still interested in working on it, please let us know.

We're working on closing out old and inactive PRs, so if you're too busy or this has too many merge conflicts to be worth picking back up, we'll be making another pass to close it out in a few weeks.

@github-actions github-actions bot removed the stale label Jan 18, 2024
@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 9, 2024

This pull request has gone a while without any activity. Tagging the Trino developer relations team: @bitsondatadev @colebow @mosabua

@github-actions github-actions bot added the stale label Feb 9, 2024
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 1, 2024

Closing this pull request, as it has been stale for six weeks. Feel free to re-open at any time.

@github-actions github-actions bot closed this Mar 1, 2024
@mosabua
Copy link
Copy Markdown
Member

mosabua commented Mar 1, 2024

Feels like this should be reopened and continued.. wdyt @grantatspothero ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed delta-lake Delta Lake connector hive Hive connector iceberg Iceberg connector stale

Development

Successfully merging this pull request may close these issues.

information_schema.tables failure when Iceberg materialized view lacks storage descriptor in glue metastore

4 participants