twalthr commented on a change in pull request #18027:
URL: https://github.com/apache/flink/pull/18027#discussion_r764072104



##########
File path: 
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/functions/casting/CastRulesTest.java
##########
@@ -783,6 +824,45 @@
         return new GenericMapData(map);
     }
 
+    public static class MyStructuredType {
+        private long a;
+        private Long b;
+        private String c;
+        private String[] d;
+
+        public long getA() {

Review comment:
       if you want to keep your code concise you can also just have public 
mutable members. should be ok for testing code.

##########
File path: 
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/functions/CastFunctionITCase.java
##########
@@ -1166,6 +1132,52 @@ protected Configuration configuration() {
                         .build());
     }
 
+    public static List<TestSpec> structuredTypes() {
+        return Arrays.asList(
+                // Cast to structuredTypes
+                // https://issues.apache.org/jira/browse/FLINK-17321
+                // MULTISET
+                // MAP
+                // RAW
+                CastTestSpecBuilder.testCastTo(ARRAY(INT()))

Review comment:
       `ARRAY(INT())` is not a structure type. are you mixing constructured 
types vs structured types?

##########
File path: 
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/functions/casting/RowToRowCastRule.java
##########
@@ -0,0 +1,232 @@
+/*
+ * 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.casting;
+
+import org.apache.flink.table.data.ArrayData;
+import org.apache.flink.table.data.binary.BinaryRowData;
+import org.apache.flink.table.data.writer.BinaryRowWriter;
+import org.apache.flink.table.types.logical.LogicalType;
+import org.apache.flink.table.types.logical.LogicalTypeRoot;
+import org.apache.flink.table.types.logical.RowType;
+
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
+
+import static org.apache.flink.table.planner.codegen.CodeGenUtils.className;
+import static org.apache.flink.table.planner.codegen.CodeGenUtils.newName;
+import static 
org.apache.flink.table.planner.codegen.CodeGenUtils.rowFieldReadAccess;
+import static 
org.apache.flink.table.planner.functions.casting.CastRuleUtils.binaryWriterWriteField;
+import static 
org.apache.flink.table.planner.functions.casting.CastRuleUtils.binaryWriterWriteNull;
+import static 
org.apache.flink.table.planner.functions.casting.CastRuleUtils.constructorCall;
+import static 
org.apache.flink.table.planner.functions.casting.CastRuleUtils.methodCall;
+
+/** {@link LogicalTypeRoot#ROW} to {@link LogicalTypeRoot#ROW} cast rule. */
+class RowToRowCastRule extends 
AbstractNullAwareCodeGeneratorCastRule<ArrayData, String> {

Review comment:
       Generics need an update.

##########
File path: 
flink-table/flink-table-common/src/test/java/org/apache/flink/table/test/TableAssertions.java
##########
@@ -28,6 +28,8 @@
 
     private TableAssertions() {}
 
+    // --- Internal data types

Review comment:
       nit: `Internal data structures`




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to