[NO ISSUE][COMP] Improve error message
- user model changes: no
- storage format changes: no
- interface changes: no
Details:
- Add function arity to the error message that
is raised when function resolution fails
Change-Id: I5bbd3571cb1ce9e25869ce61443e0b023159d9d0
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/9146
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Ian Maxon <imaxon@uci.edu>
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/LangExpressionToPlanTranslator.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/LangExpressionToPlanTranslator.java
index 6759f1c..24e1db8 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/LangExpressionToPlanTranslator.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/LangExpressionToPlanTranslator.java
@@ -885,7 +885,7 @@
AbstractFunctionCallExpression f = lookupFunction(signature, args, sourceLoc);
if (f == null) {
- throw new CompilationException(ErrorCode.UNKNOWN_FUNCTION, sourceLoc, signature.toString(false));
+ throw new CompilationException(ErrorCode.UNKNOWN_FUNCTION, sourceLoc, signature.toString());
}
if (fcall.hasAggregateFilterExpr()) {
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/flwor/at00/at00.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/flwor/at00/at00.3.query.sqlpp
index cb47163..23f3c08 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/flwor/at00/at00.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/flwor/at00/at00.3.query.sqlpp
@@ -33,4 +33,4 @@
) as gen0,
gen0.i as j at p
where p < 4
-order by partkey, shipdate;
+order by partkey, shipdate, pid;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
index b73ce69..3f6b76e 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
@@ -3018,7 +3018,7 @@
<test-case FilePath="array_fun">
<compilation-unit name="array_slice/array_slice_exception_result">
<output-dir compare="Text">array_slice/array_slice_exception_result</output-dir>
- <expected-error>ASX1081: Cannot find function with name TinySocial.array_slice</expected-error>
+ <expected-error>ASX1081: Cannot find function with signature TinySocial.array_slice()</expected-error>
</compilation-unit>
</test-case>
<test-case FilePath="array_fun">
@@ -11896,14 +11896,14 @@
<test-case FilePath="user-defined-functions">
<compilation-unit name="bad-function-ddl-5">
<output-dir compare="Text">bad-function-ddl-5</output-dir>
- <expected-error>ASX1081: Cannot find function with name experiments.function_that_does_not_exist</expected-error>
- <expected-error>ASX1081: Cannot find function with name experiments2.function_that_does_not_exist </expected-error>
+ <expected-error>ASX1081: Cannot find function with signature experiments.function_that_does_not_exist()</expected-error>
+ <expected-error>ASX1081: Cannot find function with signature experiments2.function_that_does_not_exist()</expected-error>
</compilation-unit>
</test-case>
<test-case FilePath="user-defined-functions">
<compilation-unit name="bad-function-ddl-6">
<output-dir compare="Text">bad-function-ddl-6</output-dir>
- <expected-error>ASX1081: Cannot find function with name experiments.function_that_does_not_exist</expected-error>
+ <expected-error>ASX1081: Cannot find function with signature experiments.function_that_does_not_exist(2)</expected-error>
</compilation-unit>
</test-case>
<test-case FilePath="user-defined-functions">
@@ -11921,13 +11921,13 @@
<test-case FilePath="user-defined-functions">
<compilation-unit name="bad-function-ddl-9">
<output-dir compare="Text">bad-function-ddl-9</output-dir>
- <expected-error>ASX1081: Cannot find function with name experiments.function_that_does_not_exist</expected-error>
+ <expected-error>ASX1081: Cannot find function with signature experiments.function_that_does_not_exist()</expected-error>
</compilation-unit>
</test-case>
<test-case FilePath="user-defined-functions">
<compilation-unit name="bad-function-ddl-10">
<output-dir compare="Text">bad-function-ddl-10</output-dir>
- <expected-error>ASX1081: Cannot find function with name experiments.f0</expected-error>
+ <expected-error>ASX1081: Cannot find function with signature experiments.f0(2)</expected-error>
</compilation-unit>
</test-case>
<test-case FilePath="user-defined-functions">
@@ -12005,8 +12005,8 @@
<test-case FilePath="user-defined-functions">
<compilation-unit name="drop-function-1">
<output-dir compare="Text">drop-function-1</output-dir>
- <expected-error>ASX1081: Cannot find function with name experiments.my_sum</expected-error>
- <expected-error>ASX1081: Cannot find function with name experiments.my_sum_va</expected-error>
+ <expected-error>ASX1081: Cannot find function with signature experiments.my_sum(2)</expected-error>
+ <expected-error>ASX1081: Cannot find function with signature experiments.my_sum_va(2)</expected-error>
</compilation-unit>
</test-case>
<test-case FilePath="user-defined-functions">
@@ -12053,7 +12053,7 @@
<test-case FilePath="user-defined-functions">
<compilation-unit name="query-issue455">
<output-dir compare="Text">query-issue455</output-dir>
- <expected-error>ASX1081: Cannot find function with name test.printName</expected-error>
+ <expected-error>ASX1081: Cannot find function with signature test.printName()</expected-error>
</compilation-unit>
</test-case>
<test-case FilePath="user-defined-functions">
@@ -12241,7 +12241,7 @@
<test-case FilePath="user-defined-functions">
<compilation-unit name="f01">
<output-dir compare="Text">f01</output-dir>
- <expected-error>ASX1081: Cannot find function with name test.tinyint</expected-error>
+ <expected-error>ASX1081: Cannot find function with signature test.tinyint()</expected-error>
</compilation-unit>
</test-case>
<!-- This test case is not valid anymore since we do not required "IMPORT_PRIVATE_FUNCTIONS" flag anymore -->
diff --git a/asterixdb/asterix-common/src/main/resources/asx_errormsg/en.properties b/asterixdb/asterix-common/src/main/resources/asx_errormsg/en.properties
index 22f7308..db8a70d 100644
--- a/asterixdb/asterix-common/src/main/resources/asx_errormsg/en.properties
+++ b/asterixdb/asterix-common/src/main/resources/asx_errormsg/en.properties
@@ -168,7 +168,7 @@
1078 = Unexpected operator %1$s in an OperatorExpr starting with %2$s
1079 = Compilation error: %1$s
1080 = Cannot find node group with name %1$s
-1081 = Cannot find function with name %1$s
+1081 = Cannot find function with signature %1$s
1082 = Cannot find datatype with name %1$s
1083 = Cannot find index with name %1$s
1084 = An index with this name %1$s already exists
diff --git a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/util/FunctionUtil.java b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/util/FunctionUtil.java
index 67d07f0..a33cd61 100644
--- a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/util/FunctionUtil.java
+++ b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/util/FunctionUtil.java
@@ -165,7 +165,7 @@
}
FunctionSignature fsBuiltin = builtinFunctionResolver.apply(name, arity);
if (fsBuiltin == null) {
- throw new CompilationException(ErrorCode.UNKNOWN_FUNCTION, sourceLoc, fs.toString(false));
+ throw new CompilationException(ErrorCode.UNKNOWN_FUNCTION, sourceLoc, fs.toString());
}
return fsBuiltin;
}