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

Window rowtime attribute can't be renamed in Java

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.8.0
    • Component/s: None

      Description

      Currently, we can rename window rowtime attribute like this in Scala:

      table
            .window(Tumble over 2.millis on 'rowtime as 'w)
            .groupBy('w)
            .select('w.rowtime as 'rowtime, 'int.count as 'int)
      

      However, an exception will be thrown if we use java(by changing the Expressions to String):

      table
            .window(Tumble over 2.millis on 'rowtime as 'w)
            .groupBy('w)
            .select("w.rowtime as rowtime, int.count as int")
      

      The Exception is:

      org.apache.flink.table.api.ExpressionParserException: Could not parse expression at column 11: `,' expected but `a' found
      w.rowtime as rowtime, int.count as int
      

       

      To solve the problem, we can add rename support in ExpressionParser. However, this may conflict with the design of source which use as before rowtime:

      stream.toTable(
            tEnv,
            ExpressionParser.parseExpressionList("(b as b).rowtime, c as c, a as a"): _*)
      

      Personally, I think we should keep the two consistent, so the final api would be:

      // window case
      .select("w.rowtime as rowtime, int.count as int")
      
      // source case
      stream.toTable(
            tEnv,
            ExpressionParser.parseExpressionList("b.rowtime as b, c as c, a as a"): _*)
      

      Any suggestions would be greatly appreciated!

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                hequn8128 Hequn Cheng
                Reporter:
                hequn8128 Hequn Cheng
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: