snuyanzin commented on code in PR #21934:
URL: https://github.com/apache/flink/pull/21934#discussion_r1109761449


##########
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/functions/sql/SqlRowConstructor.java:
##########
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.table.planner.functions.sql;
+
+import org.apache.calcite.rel.type.RelDataType;
+import org.apache.calcite.sql.SqlOperator;
+import org.apache.calcite.sql.SqlOperatorBinding;
+import org.apache.calcite.sql.SqlUtil;
+import org.apache.calcite.sql.fun.SqlRowOperator;
+import org.apache.calcite.util.Pair;
+
+import java.util.AbstractList;
+import java.util.Map;
+
+/** {@link SqlOperator} for <code>ROW</code>, which behaves same way as in 
Calcite 1.29.0. */
+public class SqlRowConstructor extends SqlRowOperator {
+    public SqlRowConstructor() {
+        super("ROW");
+    }
+
+    @Override
+    public RelDataType inferReturnType(SqlOperatorBinding opBinding) {
+        // The type of a ROW(e1,e2) expression is a record with the types
+        // {e1type,e2type}.  According to the standard, field names are
+        // implementation-defined.
+        return opBinding
+                .getTypeFactory()
+                .createStructType(
+                        new AbstractList<Map.Entry<String, RelDataType>>() {
+                            @Override
+                            public Map.Entry<String, RelDataType> get(int 
index) {
+                                return Pair.of(
+                                        SqlUtil.deriveAliasFromOrdinal(index),
+                                        opBinding.getOperandType(index));
+                            }
+
+                            @Override
+                            public int size() {
+                                return opBinding.getOperandCount();
+                            }
+                        });
+    }
+}

Review Comment:
   In https://issues.apache.org/jira/browse/CALCITE-3627 there has been changed 
a NullPolicy for ROW. 
   It leads to failure of 
`org.apache.flink.table.planner.functions.RowFunctionITCase` since table api 
and sql are becoming inconsistent in context of NullPolicy for ROW type 



-- 
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: issues-unsubscr...@flink.apache.org

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

Reply via email to