Michael Blow has submitted this change and it was merged. Change subject: improve error messages ......................................................................
improve error messages Change-Id: Ia82cd34ae5099f924302d7d42b541247a258c9b9 Reviewed-on: https://asterix-gerrit.ics.uci.edu/1225 Sonar-Qube: Jenkins <[email protected]> Tested-by: Jenkins <[email protected]> Integration-Tests: Jenkins <[email protected]> Reviewed-by: Michael Blow <[email protected]> --- M asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml M asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml M asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp_parser.xml M asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/util/FunctionUtil.java M asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj 5 files changed, 26 insertions(+), 8 deletions(-) Approvals: Michael Blow: Looks good to me, approved Jenkins: Verified; No violations found; Verified diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml index a244a74..0a45cdf 100644 --- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml +++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml @@ -6263,7 +6263,7 @@ <test-case FilePath="user-defined-functions"> <compilation-unit name="query-issue455"> <output-dir compare="Text">query-issue455</output-dir> - <expected-error>Error: function test.printName@0 is undefined</expected-error> + <expected-error>Error: function test.printName@0 is not defined</expected-error> </compilation-unit> </test-case> <test-case FilePath="user-defined-functions"> @@ -6439,7 +6439,7 @@ <test-case FilePath="user-defined-functions"> <compilation-unit name="f01"> <output-dir compare="Text">f01</output-dir> - <expected-error>Error: function test.int8@0 is undefined</expected-error> + <expected-error>Error: function test.int8@0 is not defined</expected-error> </compilation-unit> </test-case> <test-case FilePath="user-defined-functions"> 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 2838f1f..5dd0bd0 100644 --- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml +++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml @@ -7040,7 +7040,7 @@ <test-case FilePath="user-defined-functions"> <compilation-unit name="query-issue455"> <output-dir compare="Text">query-issue455</output-dir> - <expected-error>function test.printName@0 is undefined</expected-error> + <expected-error>function test.printName@0 is not defined</expected-error> </compilation-unit> </test-case> <test-case FilePath="user-defined-functions"> @@ -7212,7 +7212,7 @@ <test-case FilePath="user-defined-functions"> <compilation-unit name="f01"> <output-dir compare="Text">f01</output-dir> - <expected-error>function test.tinyint@0 is undefined</expected-error> + <expected-error>function test.tinyint@0 is not defined</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-app/src/test/resources/runtimets/testsuite_sqlpp_parser.xml b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp_parser.xml index 1296955..5fee98c 100644 --- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp_parser.xml +++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp_parser.xml @@ -1143,6 +1143,12 @@ </compilation-unit> </test-case> <test-case FilePath="constructor"> + <compilation-unit name="int_02"> + <expected-error>Syntax error: Could not parse numeric literal</expected-error> + <output-dir compare="AST">int_01</output-dir> + </compilation-unit> + </test-case> + <test-case FilePath="constructor"> <compilation-unit name="interval"> <output-dir compare="AST">interval</output-dir> </compilation-unit> 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 94866eb..2bc78a1 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 @@ -116,7 +116,7 @@ messageBuilder.append("function " + functionDecls.get(functionDecls.size() - 1).getSignature() + " depends upon function " + signature + " which is undefined"); } else { - messageBuilder.append("function " + signature + " is undefined "); + messageBuilder.append("function " + signature + " is not defined"); } throw new AsterixException(messageBuilder.toString()); } diff --git a/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj b/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj index 697439d..f330f40 100644 --- a/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj +++ b/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj @@ -2187,15 +2187,27 @@ } | <INTEGER_LITERAL> { - lit.setValue(new LongIntegerLiteral(new Long(token.image))); + try { + lit.setValue(new LongIntegerLiteral(Long.valueOf(token.image))); + } catch (NumberFormatException e) { + throw new ParseException("Could not parse numeric literal \"" + token.image +'"'); + } } | <FLOAT_LITERAL> { - lit.setValue(new FloatLiteral(new Float(token.image))); + try { + lit.setValue(new FloatLiteral(Float.valueOf(token.image))); + } catch (NumberFormatException e) { + throw new ParseException("Could not parse numeric literal \"" + token.image +'"'); + } } | <DOUBLE_LITERAL> { - lit.setValue(new DoubleLiteral(new Double(token.image))); + try { + lit.setValue(new DoubleLiteral(Double.valueOf(token.image))); + } catch (NumberFormatException e) { + throw new ParseException("Could not parse numeric literal \"" + token.image +'"'); + } } | <MISSING> { -- To view, visit https://asterix-gerrit.ics.uci.edu/1225 To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ia82cd34ae5099f924302d7d42b541247a258c9b9 Gerrit-PatchSet: 6 Gerrit-Project: asterixdb Gerrit-Branch: master Gerrit-Owner: Till Westmann <[email protected]> Gerrit-Reviewer: Jenkins <[email protected]> Gerrit-Reviewer: Michael Blow <[email protected]> Gerrit-Reviewer: Till Westmann <[email protected]> Gerrit-Reviewer: Yingyi Bu <[email protected]>
