You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2019/12/05 17:30:52 UTC

[GitHub] [flink] twalthr commented on a change in pull request #10368: [FLINK-14983][table-common] Add interfaces for input type inference

twalthr commented on a change in pull request #10368: [FLINK-14983][table-common] Add interfaces for input type inference
URL: https://github.com/apache/flink/pull/10368#discussion_r354449529
 
 

 ##########
 File path: flink-table/flink-table-common/src/test/java/org/apache/flink/table/types/inference/InputTypeStrategiesTest.java
 ##########
 @@ -0,0 +1,227 @@
+/*
+ * 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;
+
+import org.apache.flink.table.api.DataTypes;
+import org.apache.flink.table.api.ValidationException;
+import org.apache.flink.table.functions.FunctionKind;
+import org.apache.flink.table.types.DataType;
+import org.apache.flink.table.types.inference.strategies.BridgingInputTypeStrategy.BridgingSignature;
+import org.apache.flink.table.types.inference.utils.CallContextMock;
+import org.apache.flink.table.types.inference.utils.FunctionDefinitionMock;
+
+import org.junit.Assert;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameter;
+import org.junit.runners.Parameterized.Parameters;
+
+import javax.annotation.Nullable;
+
+import java.util.Arrays;
+import java.util.List;
+
+import static org.apache.flink.util.CoreMatchers.containsCause;
+import static org.hamcrest.CoreMatchers.equalTo;
+
+/**
+ * Tests for built-in {@link InputTypeStrategies}.
+ */
+@RunWith(Parameterized.class)
+public class InputTypeStrategiesTest {
+
+	@Parameters
+	public static List<TestSpec> testData() {
+		return Arrays.asList(
+			// no inference
+			TestSpec
+				.forInputStrategy(InputTypeStrategies.NOP)
+				.actualArgumentTypes(DataTypes.INT(), DataTypes.STRING())
+				.expectArgumentTypes(DataTypes.INT(), DataTypes.STRING()),
+
+			// incomplete inference
+			TestSpec
+				.forInputStrategy(InputTypeStrategies.NOP)
+				.actualArgumentTypes(DataTypes.NULL(), DataTypes.STRING(), DataTypes.NULL())
+				.expectErrorMessage("Invalid use of untyped NULL in arguments."),
+
+			// typed arguments help inferring a type
+			TestSpec
+				.forInputStrategy(InputTypeStrategies.NOP)
+				.typedArguments(DataTypes.INT(), DataTypes.STRING(), DataTypes.BOOLEAN())
+				.actualArgumentTypes(DataTypes.NULL(), DataTypes.STRING(), DataTypes.NULL())
 
 Review comment:
   I chose `calledWithArgumentTypes`.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services