You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flink.apache.org by "Hequn Cheng (JIRA)" <ji...@apache.org> on 2019/05/05 07:57:00 UTC

[jira] [Created] (FLINK-12402) Make validation error message for CallExpression more user friendly

Hequn Cheng created FLINK-12402:
-----------------------------------

             Summary: Make validation error message for CallExpression more user friendly
                 Key: FLINK-12402
                 URL: https://issues.apache.org/jira/browse/FLINK-12402
             Project: Flink
          Issue Type: Improvement
          Components: Table SQL / API
            Reporter: Hequn Cheng
            Assignee: Hequn Cheng


Currently, the error message for CallExpression validation may not display the root cause which may confuse our users. Take the following test as an example:

{code:java}
  @Test
  def testSimpleSelectAllWithAs(): Unit = {

    val env = StreamExecutionEnvironment.getExecutionEnvironment
    val tEnv = StreamTableEnvironment.create(env)
    StreamITCase.testResults = mutable.MutableList()
    val ds = StreamTestData.getSmall3TupleDataStream(env).toTable(tEnv, 'a, 'b, 'c)
      .select('a, 'b.log as 'b, 'c)

    val results = ds.toAppendStream[Row]
    results.addSink(new StreamITCase.StringSink[Row])
    env.execute()

    val expected = mutable.MutableList(
        "1,1,Hi",
        "2,2,Hello",
        "3,2,Hello world")
    assertEquals(expected.sorted, StreamITCase.testResults.sorted)
  }
{code}

The error message is:
{code:java}
org.apache.flink.table.api.ValidationException: Invalid arguments [log(b), 'b'] for function: as
{code}

From the error message, it shows there is something wrong with the `as` function. However, the root cause is the log function can only accept a double parameter while b is a long number.

To make it more user friendly, it would be better to display the root cause error message.



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