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:
[email protected]


With regards,
Apache Git Services

Reply via email to