[ 
https://issues.apache.org/jira/browse/CALCITE-2535?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16610114#comment-16610114
 ] 

Hongze Zhang commented on CALCITE-2535:
---------------------------------------

{quote}FNL-3 was to implement exceptions in a runtime system that we no longer 
use.
{quote}
I got.
{quote}So please don't over-fit the code and the testing to where the exception 
is discovered before the query is even run.
{quote}
[~julianhyde] If the way I run the tests is right, currently 
[TesterImpl#checkFails|https://github.com/apache/calcite/blob/8f43b3b8a592792e51feb75f2371582eb5013a70/core/src/test/java/org/apache/calcite/sql/test/SqlTesterImpl.java#L478]
 does not even check failures both at "loading generated code" time and 
"running generated code" time(no matter true or false set to parameter 
"runtime"). It just checks the sql node validation(when parameter 
runtime=true), which never triggers a code generation, this is the major 
problem I wanted to solve.

The problem causes several test cases wrongly passed, e.g.
{code:java}
tester.checkFails(
 "100.1 / 0.00000000000000001", OUT_OF_RANGE_MESSAGE,
 true);{code}
In the function 
[SqlFunctions#divide|https://github.com/apache/calcite/blob/8f43b3b8a592792e51feb75f2371582eb5013a70/core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java#L696],
 100.1 / 0.00000000000000001 does not throws exceptions, whereas the test case 
expected one, the test should fail but wrongly passed.

This is only caused by the wrong logic in Tester#checkFails, the constant code 
folding part is not relevant.

> Runtime failure check not working in SqlTesterImpl.java
> -------------------------------------------------------
>
>                 Key: CALCITE-2535
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2535
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: Hongze Zhang
>            Assignee: Julian Hyde
>            Priority: Major
>
> Problem at SqlTesterImpl#checkFails:
> When argument "runtime" is specified as true, error assertion and error 
> message matching will not be performed.
> This issue could result in wrong test result in SqlOperatorBaseTest.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to