You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2021/01/14 03:21:34 UTC

[GitHub] [calcite] xwkuang5 opened a new pull request #2326: [CALCITE-4265] Improve error message when CAST to unknown type (Louis

xwkuang5 opened a new pull request #2326:
URL: https://github.com/apache/calcite/pull/2326


   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.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [calcite] danny0405 commented on a change in pull request #2326: [CALCITE-4265] Improve error message when CAST to unknown type (Louis

Posted by GitBox <gi...@apache.org>.
danny0405 commented on a change in pull request #2326:
URL: https://github.com/apache/calcite/pull/2326#discussion_r564175002



##########
File path: core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java
##########
@@ -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()));

Review comment:
       How about using `node.getKind() == SqlKind.IDENTIFIER` ?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [calcite] xwkuang5 commented on pull request #2326: [CALCITE-4265] Improve error message when CAST to unknown type (Louis

Posted by GitBox <gi...@apache.org>.
xwkuang5 commented on pull request #2326:
URL: https://github.com/apache/calcite/pull/2326#issuecomment-782887180


   > +1, fine with the change.
   
   Hi Danny, when can we merge this PR?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [calcite] xwkuang5 commented on a change in pull request #2326: [CALCITE-4265] Improve error message when CAST to unknown type (Louis

Posted by GitBox <gi...@apache.org>.
xwkuang5 commented on a change in pull request #2326:
URL: https://github.com/apache/calcite/pull/2326#discussion_r565007986



##########
File path: core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java
##########
@@ -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()));

Review comment:
       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. 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [calcite] danny0405 closed pull request #2326: [CALCITE-4265] Improve error message when CAST to unknown type (Louis

Posted by GitBox <gi...@apache.org>.
danny0405 closed pull request #2326:
URL: https://github.com/apache/calcite/pull/2326


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [calcite] danny0405 commented on a change in pull request #2326: [CALCITE-4265] Improve error message when CAST to unknown type (Louis

Posted by GitBox <gi...@apache.org>.
danny0405 commented on a change in pull request #2326:
URL: https://github.com/apache/calcite/pull/2326#discussion_r564175002



##########
File path: core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java
##########
@@ -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()));

Review comment:
       How about using `node.getKind() == SqlKind.IDENTIFIER` ?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org