caicancai commented on code in PR #3721:
URL: https://github.com/apache/calcite/pull/3721#discussion_r1580341451


##########
core/src/main/java/org/apache/calcite/sql/fun/SqlLibraryOperators.java:
##########
@@ -1163,6 +1163,52 @@ private static RelDataType 
mapReturnType(SqlOperatorBinding opBinding) {
         false);
   }
 
+  @SuppressWarnings("argument.type.incompatible")
+  private static RelDataType mapKeyReturnType(SqlOperatorBinding opBinding) {
+    List<RelDataType> operandType = new ArrayList<>();
+
+    operandType.add(opBinding.collectOperandTypes().get(0).getKeyType());
+    operandType.add(opBinding.collectOperandTypes().get(0).getValueType());
+    Pair<@Nullable RelDataType, @Nullable RelDataType> type =
+        getComponentTypes(
+            opBinding.getTypeFactory(), operandType);
+
+    requireNonNull(type.left, () -> "type left of " + type.left);
+    requireNonNull(type.right, () -> "type right of " + type.right);
+    if (type.left.getSqlTypeName() != SqlTypeName.UNKNOWN
+        && type.right.getSqlTypeName() != SqlTypeName.UNKNOWN) {
+      SqlValidatorUtil.adjustTypeForMapFunctionConstructor(type, opBinding);

Review Comment:
   Sorry, I misunderstood what you meant. Of course there are other similar 
encodings
   https://issues.apache.org/jira/browse/CALCITE-5976
   https://issues.apache.org/jira/browse/CALCITE-5948



##########
core/src/main/java/org/apache/calcite/sql/fun/SqlLibraryOperators.java:
##########
@@ -1163,6 +1163,52 @@ private static RelDataType 
mapReturnType(SqlOperatorBinding opBinding) {
         false);
   }
 
+  @SuppressWarnings("argument.type.incompatible")
+  private static RelDataType mapKeyReturnType(SqlOperatorBinding opBinding) {
+    List<RelDataType> operandType = new ArrayList<>();
+
+    operandType.add(opBinding.collectOperandTypes().get(0).getKeyType());
+    operandType.add(opBinding.collectOperandTypes().get(0).getValueType());
+    Pair<@Nullable RelDataType, @Nullable RelDataType> type =
+        getComponentTypes(
+            opBinding.getTypeFactory(), operandType);
+
+    requireNonNull(type.left, () -> "type left of " + type.left);
+    requireNonNull(type.right, () -> "type right of " + type.right);
+    if (type.left.getSqlTypeName() != SqlTypeName.UNKNOWN
+        && type.right.getSqlTypeName() != SqlTypeName.UNKNOWN) {
+      SqlValidatorUtil.adjustTypeForMapFunctionConstructor(type, opBinding);

Review Comment:
   @mihaibudiu Sorry, I misunderstood what you meant. Of course there are other 
similar encodings
   https://issues.apache.org/jira/browse/CALCITE-5976
   https://issues.apache.org/jira/browse/CALCITE-5948



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

To unsubscribe, e-mail: commits-unsubscr...@calcite.apache.org

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

Reply via email to