You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Fabian Hueske (JIRA)" <ji...@apache.org> on 2018/03/15 15:18:00 UTC

[jira] [Comment Edited] (FLINK-8930) TableApi validation test in ScalarFunctionsValidationTest doesn't work

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

Fabian Hueske edited comment on FLINK-8930 at 3/15/18 3:17 PM:
---------------------------------------------------------------

OK, I see what you mean.

The difference is that the SQL expression is validated by Calcite and the Table API expression by the Table API. The SQL validation actually succeeds but Calcite also tries to simplify the expression by evaluating it because all input parameters are constants. This means that the function is invoked on the constant parameters. If you change the test SQL call to {{testSqlApi("rpad(f8,-1,'')", "null")}} ({{f8}} is a String field and hence not constant), you'll find that it is executed just like the Table API test method.

In general, this error is not a validation but a runtime error, because it is not caused by invalid types but by invalid values at runtime.

From my point of view, this is all expected behavior. I'd suggest to close this issue.

Feel free to reopen the issue if you don't agree.


was (Author: fhueske):
OK, I see what you mean.

The difference is that the SQL expression is validated by Calcite and the Table API expression by the Table API. The SQL validation actually succeeds but Calcite also tries to simplify the expression by evaluating it because all input parameters are constants. This means that the function is invoked on the constant parameters. If you change the test SQL call to {{testSqlApi("rpad(f8,-1,'')", "null")}} ({{f8}} is a String field and hence not constant), you'll find that it is executed just like the Table API test method.

In general, this error is not a validation but a runtime error, because it is not caused by invalid types but by invalid values at runtime.

From my point of view, this is all expected behavior. I'd suggest to close this issue.

> TableApi validation test in ScalarFunctionsValidationTest doesn't work
> ----------------------------------------------------------------------
>
>                 Key: FLINK-8930
>                 URL: https://issues.apache.org/jira/browse/FLINK-8930
>             Project: Flink
>          Issue Type: Bug
>          Components: Table API &amp; SQL
>            Reporter: Wind
>            Priority: Major
>
> I'm wring a validation test for [FLINK-6924|https://issues.apache.org/jira/browse/FLINK-6924] in org.apache.flink.table.expressions.validation.ScalarFunctionsValidationTest. However, I find that the table api is not truely executed in function "testTableApi", which is different from "testSqlApi". So we can only test exceptions which are thrown in "addTableApiTestExpr" like "ValidationException" because it is thrown during "select" operation. 



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