hanyuzheng7 commented on code in PR #22730:
URL: https://github.com/apache/flink/pull/22730#discussion_r1244090446


##########
flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/inference/strategies/ComparabilityUtils.java:
##########
@@ -0,0 +1,67 @@
+/*
+ * 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.types.inference.strategies;
+
+import org.apache.flink.annotation.Internal;
+import org.apache.flink.table.types.logical.LegacyTypeInformationType;
+import org.apache.flink.table.types.logical.LogicalType;
+import org.apache.flink.table.types.logical.LogicalTypeFamily;
+import org.apache.flink.table.types.logical.LogicalTypeRoot;
+
+/** Specific for {@link ArrayElementArgumentTypeStrategy}. */
+@Internal
+public class ComparabilityUtils {

Review Comment:
   ComparableTypeStrategy cannot use this method. 
   
   Because it contain
   ```
    private boolean areTypesOfSameRootComparable(LogicalType firstType, 
LogicalType secondType) {
           switch (firstType.getTypeRoot()) {
               case ARRAY:
               case MULTISET:
               case MAP:
               case ROW:
                   return areConstructedTypesComparable(firstType, secondType);
               case DISTINCT_TYPE:
                   return areDistinctTypesComparable(firstType, secondType);
               case STRUCTURED_TYPE:
                   return areStructuredTypesComparable(firstType, secondType);
               case RAW:
                   return areRawTypesComparable(firstType, secondType);
               default:
                   return true;
           }
       }
   ```
   but my method didn't contain it.
   
   and 
    ```
    private Boolean hasRequiredComparison(StructuredType structuredType) {
           switch (requiredComparison) {
               case EQUALS:
                   return structuredType.getComparison().isEquality();
               case FULL:
                   return structuredType.getComparison().isComparison();
               case NONE:
               default:
                   // this is not important, required comparison will never be 
NONE
                   return true;
           }
       }
   ```
   contain requiredComparison, and I will transfer a requiredComparison to the 
ComparabilityUtils
   
   and  
   ```
    private boolean areConstructedTypesComparable(LogicalType firstType, 
LogicalType secondType) {
           List<LogicalType> firstChildren = firstType.getChildren();
           List<LogicalType> secondChildren = secondType.getChildren();
   
           if (firstChildren.size() != secondChildren.size()) {
               return false;
           }
   
           for (int i = 0; i < firstChildren.size(); i++) {
               if (!areComparable(firstChildren.get(i), secondChildren.get(i))) 
{
                   return false;
               }
           }
   
           return true;
       }
   ```
   will call areComparable, so we need to transfer areComparable to the 
ComparabilityUtils.
   
   so we have to generate a many methods in class ComparabilityUtils.
   But it will change ComparableTypeStrategy a lots. In the end the structure 
of ComparableTypeStrategy will change totally. So I suggest that we do not 
change the ComparableTypeStrategy.



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