feat(isthmus-cli): explain common SQL conversion errors instead of dumping stack traces - #1060
Open
nielspardon wants to merge 1 commit into
Open
feat(isthmus-cli): explain common SQL conversion errors instead of dumping stack traces#1060nielspardon wants to merge 1 commit into
nielspardon wants to merge 1 commit into
Conversation
…mping stack traces Failures caused by the SQL given to the CLI are now reported as a message plus a hint naming the option to reach for, rather than as a raw Calcite stack trace. An undefined table points at -c / --create, an unresolved column or identifier explains where columns come from, and a CREATE TABLE passed as the query -- or a query passed to -c -- points at the other one. Anything that is not recognizably an input problem keeps its stack trace, and --stacktrace restores it for the recognized ones. Missing input is a usage error now: with neither a query nor -e the CLI reported a NullPointerException, and main no longer parses arguments ahead of execute(), so a mistyped argument gets picocli's usage error instead of an UnmatchedArgumentException trace. Also guards processCreateStatementsToSchema against CREATE TABLE AS SELECT, as its sibling processCreateStatements already did; without it a CTAS statement in -c dereferenced a null column list. Closes substrait-io#113
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.
isthmus "SELECT * FROM foo"answered a beginner's first attempt with a 40-lineCalciteContextExceptionstack trace that never mentioned-c/--create. Every other way to get the input wrong behaved the same way, up to an outrightNullPointerExceptionwhen no query was passed at all.What changes
-c/--create(with its own name in the example), an unresolved column or an unresolved identifier in-e/--expressionexplains where columns come from and mentions--unquotedcasing, and aCREATE TABLEgiven as the query — or a query given to-c— points at the other one.--stacktraceprints the message and the full trace for the recognized failures.-ethe CLI threw aNullPointerException; it now printsMissing SQL to convertplus the usage. Relatedly,mainno longer parses arguments ahead ofexecute(), so an unquoted or mistyped argument gets picocli's usage error rather than anUnmatchedArgumentExceptiontrace. Both exit 2, picocli's invalid-input code, where the uncaught exceptions previously exited 1.processCreateStatementsToSchemaagainst CTAS, as its siblingprocessCreateStatementsalready did. Without the guard,-c "CREATE TABLE foo AS SELECT 1"dereferenced a null column list — a parameter declared@NonNull— and failed with anNPEinstead ofCTAS not supported.The
--helpblock in the isthmus-cli readme reflows beyond the added line because the new option widens picocli's option column.Closes #113
🤖 Generated with AI