Replace exception-driven view detection in Hive and Iceberg metadata layers#29231
Open
laserninja wants to merge 1 commit intotrinodb:masterfrom
Open
Replace exception-driven view detection in Hive and Iceberg metadata layers#29231laserninja wants to merge 1 commit intotrinodb:masterfrom
laserninja wants to merge 1 commit intotrinodb:masterfrom
Conversation
…layers Move view/materialized-view detection from getRefreshedLocation() to loadTable() in both TrinoHiveCatalog and TrinoGlueCatalog so that views are rejected early with a clean TableNotFoundException instead of relying on catching exceptions thrown deep inside Iceberg table loading. In HiveMetadata.streamTableColumns(), pre-check the metastore before entering the try block so views are skipped without triggering (and catching) a TrinoException. Closes trinodb#29163
e587bdd to
20787f6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Move view/materialized-view detection from
getRefreshedLocation()toloadTable()in bothTrinoHiveCatalogandTrinoGlueCatalogso that views are rejected early with a cleanTableNotFoundExceptioninstead of relying on catching exceptions thrown deep inside Iceberg table loading.In
HiveMetadata.streamTableColumns(), pre-check the metastore before entering the try block so views are skipped without triggering (and catching) aTrinoException.Additional context and related issues
Fixes #29163
The core insight is that
getRefreshedLocation()is only reachable through theloadTable()→loadIcebergTable()→refresh()call chain, so moving the view check intoloadTable()makes the downstream check dead code.Changes
Iceberg – HMS catalog
TrinoHiveCatalog.loadTable(): Fetch the metastore table upfront; throwTableNotFoundExceptionif absent or any kind of view.AbstractMetastoreTableOperations.getRefreshedLocation(): Remove now-dead view detection block and unused imports.Iceberg – Glue catalog
TrinoGlueCatalog.loadTable(): CheckisTrinoView/isTrinoMaterializedViewbefore creatingTableOperations; throwTableNotFoundExceptionearly.GlueIcebergTableOperations.getRefreshedLocation(): Remove now-dead view detection block and unused imports/variables.Hive
HiveMetadata.streamTableColumns(): Pre-check the metastore table before the try block; returnStream.empty()when the table is missing or is a view (unless it is a Hive view andtranslateHiveViewsis enabled).Release notes
(x) This is not user-visible or is docs only, and no release notes are required.