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

GroupBy udf() can not be select in TableAPI

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 1.8.0
    • None
    • Table SQL / API
    • None

    Description

      The group key can not be select in the follows TableAPI:

      val result = order
        .groupBy('o_time.substring(1, 16))
        .select('o_time.substring(1, 16), 'o_id.count)

      Exception:

      org.apache.flink.table.api.ValidationException: Cannot resolve field [o_time] given input [('o_time).substring(1, 16), TMP_0].
      
      at org.apache.flink.table.plan.logical.LogicalNode.failValidation(LogicalNode.scala:156)

      BTW, We can only use the following description to avoid the above problem.

      val result = order
        .select('o_id, 'c_id, 'o_time.substring(1, 16) as 'key)
        .groupBy('key)
        .select('key, 'o_id.count)
      

      But I think it is better to make `groupby udf()` can be select in TableAPI. What do you think?

      Attachments

        Issue Links

          Activity

            People

              dian.fu Dian Fu
              sunjincheng121 sunjincheng
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: