HIVE-27957: Better error message for STORED BY - #4954
Conversation
| .map(Enum::toString) | ||
| .collect(Collectors.joining(", ")); | ||
| throw new SemanticException(String.format( | ||
| "Unrecognized storage handler in STORED BY clause: %s. Supported types = %s or FQCN of a storage handler", |
There was a problem hiding this comment.
I like this initiative because hive error message is too massy, and need a pilot certificate to understand it. So big plus for it!
On the other hand, I would recommend the following message like:
The storage handler specified in the STORED BY clause is not recognized: %s. Please use one of the supported types, which are %s, or provide the Fully Qualified Class Name (FQCN) of a valid storage handler.
Even thinking the second half of the sentence is too technical.
There was a problem hiding this comment.
I simply followed it as it sounds better. I will update more if anyone has a better idea
136035e
|
Changes LGTM +1, Thanks |
|
@deniskuzZ @ayushtkn @abstractdog Could you pls check this? |
|
|
||
| public enum StorageHandlerTypes { | ||
| DEFAULT(), | ||
| ICEBERG("\'org.apache.iceberg.mr.hive.HiveIcebergStorageHandler\'", |
There was a problem hiding this comment.
wow, what was this backslash used for and why?
There was a problem hiding this comment.
I'm not sure about the original intention. IntelliJ asks me to remove the backslash and it seems to be safe to remove.
| if (type.name().equalsIgnoreCase(node.getText())) { | ||
| inputFormat = type.inputFormat(); | ||
| outputFormat = type.outputFormat(); | ||
| assert type.className != null; |
There was a problem hiding this comment.
assert is not supposed for production AFAIK, please use explicit null checking here, e.g. Objects.requireNonNull
this assertion can be done before assigning inpoutFormat/outputFormat
className(), I guess you might want to use method / direct access consistently
There was a problem hiding this comment.
In my opinion, either is fine as this doesn't validate users' input but does assert invariant conditions of enum values for readability. I mean the current implementation doesn't care about the possibility where we add an enum value with null or a wrong class name. What do you think?
As for the direct access, I will fix that.
There was a problem hiding this comment.
the problem with assert is that it's not meant for production, it can be completely bypassed with JVM args
There was a problem hiding this comment.
Thanks. You mean we'd like this validation to be effective at runtime. I replaced the assertion, rebased it based on the latest master, and then confirmed tests succeeded.
df90d42
|
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
|
@abstractdog, could this be merged or some comments are still pending? |
there are minor comments unaddressed |
00299c5 to
d94983b
Compare
d94983b to
df90d42
Compare
|
LGTM, pending tests |
|




What changes were proposed in this pull request?
This PR would change an error message thrown when a user gives a wrong storage format in STORED BY.
Why are the changes needed?
The current messages are less informative. I got confused while I was testing Iceberg and non-Iceberg tables in turns.
Does this PR introduce any user-facing change?
It changes only error messages.
Is the change a dependency upgrade?
No.
How was this patch tested?
I added test cases.