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

 ##########
 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:
   I've used ```getField(...)``` method with case sensitivity ```false``` like 
in DOT operator. 

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to