dawidwys commented on a change in pull request #10312: 
[FLINK-12996][table-common] Add type validators and strategies for FLIP-65
URL: https://github.com/apache/flink/pull/10312#discussion_r350170026
 
 

 ##########
 File path: 
flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/inference/validators/CompositeTypeValidator.java
 ##########
 @@ -0,0 +1,331 @@
+/*
+ * 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.validators;
+
+import org.apache.flink.annotation.Internal;
+import org.apache.flink.table.functions.FunctionDefinition;
+import org.apache.flink.table.types.DataType;
+import org.apache.flink.table.types.inference.ArgumentCount;
+import org.apache.flink.table.types.inference.CallContext;
+import org.apache.flink.table.types.inference.ConstantArgumentCount;
+import org.apache.flink.table.types.inference.InputTypeValidator;
+import org.apache.flink.table.types.inference.Signature;
+import org.apache.flink.util.Preconditions;
+
+import javax.annotation.Nullable;
+
+import java.util.AbstractList;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+/**
+ * Validator that checks for set of {@link InputTypeValidator}s. It is able to 
combine function signature validators
+ * or single argument validators.
+ *
+ * <p>This validator offers different semantics depending on the passed {@link 
Composition}.
+ *
+ * <p>AND: Conjunction of multiple {@link InputTypeValidator}s into one like 
{@code f(NUMERIC) && f(LITERAL)}. Only
+ * the first validator is used for signature generation.
+ *
+ * <p>OR: Disjunction of multiple {@link InputTypeValidator}s into one like 
{@code f(NUMERIC) || f(STRING)}.
+ *
+ * <p>SEQUENCE: A sequence of {@link SingleInputTypeValidator}s for validating 
an entire function signature
+ * like {@code f(STRING, NUMERIC)}.
+ */
+@Internal
+public final class CompositeTypeValidator implements SingleInputTypeValidator {
 
 Review comment:
   How about splitting the class into `AndTypeValidator`, `OrTypeValidator`, 
`SequenceTypeValidator`. They do not share much of the code. The class is quite 
hard to read though. As you must think of 3 different concepts at once. The 
methods are quite long and not easiest to read the way they are right now.

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


With regards,
Apache Git Services

Reply via email to