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 2019/08/15 04:23:16 UTC

[GitHub] [calcite] danny0405 commented on a change in pull request #1374: [CALCITE-3138] Restructuring ROW type fields is not supported

danny0405 commented on a change in pull request #1374: [CALCITE-3138] Restructuring ROW type fields is not supported
URL: https://github.com/apache/calcite/pull/1374#discussion_r314170313
 
 

 ##########
 File path: core/src/main/java/org/apache/calcite/sql/fun/SqlItemOperator.java
 ##########
 @@ -125,6 +128,14 @@ private SqlSingleOperandTypeChecker getChecker(SqlCallBinding callBinding) {
     case MAP:
       return typeFactory.createTypeWithNullability(operandType.getValueType(),
           true);
+    case ROW:
+      int lastOperandIdx = opBinding.getOperandCount() - 1;
+      String fieldName = opBinding.getOperandLiteralValue(lastOperandIdx, String.class);
+      return operandType.getFieldList().stream()
+          .filter(field -> field.getName().equalsIgnoreCase(fieldName))
+          .findFirst().map(RelDataTypeField::getType)
 
 Review comment:
   You can get the `NameMatcher` from `CatalogReader` of `SqlValidator` to decide the case sensitivity.

----------------------------------------------------------------
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


With regards,
Apache Git Services