sunjincheng created FLINK-11243:
-----------------------------------

             Summary: GroupBy udf() can not be select in TableAPI
                 Key: FLINK-11243
                 URL: https://issues.apache.org/jira/browse/FLINK-11243
             Project: Flink
          Issue Type: Bug
          Components: Table API & SQL
    Affects Versions: 1.8.0
            Reporter: sunjincheng


The group key can not be select in the follows TableAPI:
{code:java}
val result = order
  .groupBy('o_time.substring(1, 16))
  .select('o_time.substring(1, 16), 'o_id.count){code}
Exception:
{code:java}
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){code}
BTW, We can only use the following description to avoid the above problem.
{code:java}
val result = order
  .select('o_id, 'c_id, 'o_time.substring(1, 16) as 'key)
  .groupBy('key)
  .select('key, 'o_id.count)
{code}

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






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

Reply via email to