Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-33248

Calling CURRENT_WATERMARK without parameters gives IndexOutOfBoundsException

    XMLWordPrintableJSON

Details

    Description

      Create a table

      Flink SQL> CREATE TABLE T (ts TIMESTAMP(3)) WITH ('connector'='values', 'bounded'='true');
      [INFO] Execute statement succeed. 

      Select CURRENT_WATERMARK without parameters

      Flink SQL> SELECT ts, CURRENT_WATERMARK() FROM T;
      [ERROR] Could not execute SQL statement. Reason:
      java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0 

      Logs from sql-client:

      2023-10-11 14:58:20,576 ERROR org.apache.flink.table.gateway.service.operation.OperationManager [] - Failed to execute the operation cc8d29d3-e6ad-428a-92ea-b0a2a72c25f9.
      org.apache.flink.table.api.ValidationException: SQL validation failed. Unexpected error in type inference logic of function 'CURRENT_WATERMARK'. This is a bug.
          at org.apache.flink.table.planner.calcite.FlinkPlannerImpl.org$apache$flink$table$planner$calcite$FlinkPlannerImpl$$validate(FlinkPlannerImpl.scala:200) ~[?:?]
          at org.apache.flink.table.planner.calcite.FlinkPlannerImpl.validate(FlinkPlannerImpl.scala:117) ~[?:?]
          at org.apache.flink.table.planner.operations.SqlNodeToOperationConversion.convert(SqlNodeToOperationConversion.java:261) ~[?:?]
          at org.apache.flink.table.planner.delegation.ParserImpl.parse(ParserImpl.java:106) ~[?:?]
          at org.apache.flink.table.gateway.service.operation.OperationExecutor.executeStatement(OperationExecutor.java:187) ~[flink-sql-gateway-1.19-SNAPSHOT.jar:1.19-SNAPSHOT]
          at org.apache.flink.table.gateway.service.SqlGatewayServiceImpl.lambda$executeStatement$1(SqlGatewayServiceImpl.java:212) ~[flink-sql-gateway-1.19-SNAPSHOT.jar:1.19-SNAPSHOT]
          at org.apache.flink.table.gateway.service.operation.OperationManager.lambda$submitOperation$1(OperationManager.java:119) ~[flink-sql-gateway-1.19-SNAPSHOT.jar:1.19-SNAPSHOT]
          at org.apache.flink.table.gateway.service.operation.OperationManager$Operation.lambda$run$0(OperationManager.java:258) ~[flink-sql-gateway-1.19-SNAPSHOT.jar:1.19-SNAPSHOT]
          at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
          at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
          at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
          at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
          at java.lang.Thread.run(Thread.java:829) [?:?] 

       

      Expected Behavior:
      It should return a SqlValidatorException: No match found for function signature CURRENT_WATERMARK()

      This is inline with other functions which expects a parameter
      Example:

      Flink SQL> SELECT ARRAY_JOIN();
      [ERROR] Could not execute SQL statement. Reason:
      org.apache.calcite.sql.validate.SqlValidatorException: No match found for function signature ARRAY_JOIN()

       

      Attachments

        Issue Links

          Activity

            People

              bvarghese Bonnie Varghese
              bvarghese Bonnie Varghese
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: