Treat Hive schema errors as EXTERNAL#22893
Merged
dain merged 2 commits intotrinodb:masterfrom Aug 4, 2024
Merged
Conversation
dain
reviewed
Jul 31, 2024
lib/trino-hive-formats/src/main/java/io/trino/hive/formats/HiveFormatUtils.java
Outdated
Show resolved
Hide resolved
lib/trino-hive-formats/src/main/java/io/trino/hive/formats/InvalidHiveSchemaException.java
Outdated
Show resolved
Hide resolved
plugin/trino-hive/src/main/java/io/trino/plugin/hive/HiveMetadata.java
Outdated
Show resolved
Hide resolved
plugin/trino-hive/src/main/java/io/trino/plugin/hive/HivePageSourceProvider.java
Outdated
Show resolved
Hide resolved
plugin/trino-hive/src/main/java/io/trino/plugin/hive/HiveWriterFactory.java
Outdated
Show resolved
Hide resolved
Member
|
The exception catching and wrapping turned out to be fairly messy. Can you try an alternate version that throws |
cc3f2e3 to
7eee758
Compare
Contributor
Author
Done. |
electrum
approved these changes
Aug 1, 2024
lib/trino-hive-formats/src/test/java/io/trino/hive/formats/TestHiveFormatUtils.java
Outdated
Show resolved
Hide resolved
7eee758 to
77225a0
Compare
We were previously throwing IllegalArgumentException, which is turned into a GENERIC_INTERNAL_ERROR by QueryStateMachine. That's wrong, as the error is external.
77225a0 to
a45c069
Compare
Contributor
Author
|
CI failure is #22861 |
dain
approved these changes
Aug 4, 2024
Member
|
Just for reference, we generally don't document error messaging improvements in release notes - users who encounter the errors will have all the information/documentation they need when those errors arise. |
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
HiveFormatUtils sometimes throw exceptions upon encountering schema errors. These are not TrinoExceptions, so they get automatically converted to GENERIC_INTERNAL_ERROR code by QueryStateMachine. This is not correct, as the error is external, coming from the Hive table schema.
Fix it by throwing TrinoException in those cases, with a new error code for Hive schema problems.
Additional context and related issues
The new error code was added in the Hive plugin, where the HiveErrorCode enum lives. This is, unfortunately, not visible from
io.trino.hive.formats, so I added a new exception type there and tried to catch it along all call-chains in the Hive plugin to convert it to the new error code.Release notes
( ) This is not user-visible or is 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: