[
https://issues.apache.org/jira/browse/FLINK-8930?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16398640#comment-16398640
]
Wind commented on FLINK-8930:
-----------------------------
[~fhueske] , thanks for replying me.
I've written an example based on function "rpad" for you. To reproduce this
problem, you have to throw an exception in "rpad" instead of "return null" just
like what function "log" does.
In "ScalarFunctionsValidationTest.scala" we add a new test case for "rpad"
{code:java}
@Test(expected = classOf[IllegalArgumentException])
def scalaTestForRPAD(): Unit = {
// testTableApi("".rpad(-1, ""),"RPAD('',-1,'')", "null")
// testSqlApi("rpad('',-1,'')", "null")
}
{code}
In "ScalarFunctions.scala" we replace "return null" of function "rpad" with
"IllegalArgumentException"
{code:java}
if (len < 0) {
throw new IllegalArgumentException(s"Test")
{code}
After you modify these two files, you can run these two tests I wrote, and you
will find the validation steps are not the same for TableApi and SqlApi.
> 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 & 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)