Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CALCITE-4265] Improve error message when CAST to unknown type (Louis #2326

Closed
wants to merge 1 commit into from

Conversation

xwkuang5
Copy link
Contributor

Kuang)

If SqlNode is an Identifier node whose type can not be derived, throws
a validation error instead of an UnsupportedOperationException to improve
error message.

@@ -1759,6 +1759,9 @@ protected SqlSelect createSourceSelectForDelete(SqlDelete call) {
@Override public RelDataType getValidatedNodeType(SqlNode node) {
RelDataType type = getValidatedNodeTypeIfKnown(node);
if (type == null) {
if (node.isA(ImmutableSet.of(SqlKind.IDENTIFIER))) {
throw newValidationError(node, RESOURCE.unknownIdentifier(node.toString()));
Copy link
Contributor

Choose a reason for hiding this comment

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

How about using node.getKind() == SqlKind.IDENTIFIER ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

I forced push the commit since this is a small change whose history probably should not be kept. Curious what the recommended approach is for ammending PRs in calcite.

Kuang)

If SqlNode is an Identifier node whose type can not be derived, throws
a validation error instead of an UnsupportedOperationException to improve
error message.
Copy link
Contributor

@danny0405 danny0405 left a comment

Choose a reason for hiding this comment

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

+1, fine with the change.

@xwkuang5
Copy link
Contributor Author

+1, fine with the change.

Hi Danny, when can we merge this PR?

@danny0405 danny0405 closed this in 207bc8a Feb 22, 2021
@xwkuang5 xwkuang5 deleted the calcite-4265-second-attempt branch March 10, 2021 02:35
XuQianJin-Stars pushed a commit to XuQianJin-Stars/calcite that referenced this pull request Jul 14, 2021
Kuang)

If SqlNode is an Identifier node whose type can not be derived, throws
a validation error instead of an UnsupportedOperationException to improve
error message.

close apache#2326
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants