You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by tw...@apache.org on 2020/07/21 06:23:43 UTC
[flink] branch master updated: [FLINK-18628][table-common] Fix
error message for overloaded function with same parameter names
This is an automated email from the ASF dual-hosted git repository.
twalthr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git
The following commit(s) were added to refs/heads/master by this push:
new 00dc962 [FLINK-18628][table-common] Fix error message for overloaded function with same parameter names
00dc962 is described below
commit 00dc962d10b0bde7b254b8bc14aebed35dc21bdd
Author: Timo Walther <tw...@apache.org>
AuthorDate: Fri Jul 17 15:00:11 2020 +0200
[FLINK-18628][table-common] Fix error message for overloaded function with same parameter names
This closes #12928.
---
.../flink/table/types/inference/TypeInferenceUtil.java | 2 +-
.../flink/table/types/inference/InputTypeStrategiesTest.java | 12 +++++++++++-
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/inference/TypeInferenceUtil.java b/flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/inference/TypeInferenceUtil.java
index e4c09da..571ef5d 100644
--- a/flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/inference/TypeInferenceUtil.java
+++ b/flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/inference/TypeInferenceUtil.java
@@ -170,7 +170,7 @@ public final class TypeInferenceUtil {
TypeInference typeInference,
String name,
FunctionDefinition definition) {
- if (typeInference.getNamedArguments().isPresent() || typeInference.getTypedArguments().isPresent()) {
+ if (typeInference.getTypedArguments().isPresent()) {
return formatNamedOrTypedArguments(name, typeInference);
}
return typeInference.getInputTypeStrategy().getExpectedSignatures(definition)
diff --git a/flink-table/flink-table-common/src/test/java/org/apache/flink/table/types/inference/InputTypeStrategiesTest.java b/flink-table/flink-table-common/src/test/java/org/apache/flink/table/types/inference/InputTypeStrategiesTest.java
index 57a48af..5226089 100644
--- a/flink-table/flink-table-common/src/test/java/org/apache/flink/table/types/inference/InputTypeStrategiesTest.java
+++ b/flink-table/flink-table-common/src/test/java/org/apache/flink/table/types/inference/InputTypeStrategiesTest.java
@@ -600,7 +600,17 @@ public class InputTypeStrategiesTest extends InputTypeStrategiesTestBase {
)
.calledWithArgumentTypes(DataTypes.of(SimpleStructuredType.class).notNull())
.expectSignature("f(<COMPOSITE>)")
- .expectArgumentTypes(DataTypes.of(SimpleStructuredType.class).notNull())
+ .expectArgumentTypes(DataTypes.of(SimpleStructuredType.class).notNull()),
+
+ TestSpec
+ .forStrategy(
+ "Same named arguments for overloaded method.",
+ or(
+ sequence(explicit(DataTypes.STRING())),
+ sequence(explicit(DataTypes.INT()))))
+ .namedArguments("sameName")
+ .calledWithArgumentTypes(DataTypes.BOOLEAN())
+ .expectErrorMessage("Invalid input arguments. Expected signatures are:\nf(STRING)\nf(INT)")
);
}