flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLINK-5906) Add support to register UDAGG in Table and SQL API
Date Wed, 03 May 2017 13:50:04 GMT

    [ https://issues.apache.org/jira/browse/FLINK-5906?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15994909#comment-15994909
] 

ASF GitHub Bot commented on FLINK-5906:
---------------------------------------

Github user twalthr commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3809#discussion_r114541011
  
    --- Diff: flink-libraries/flink-table/src/main/scala/org/apache/flink/table/expressions/aggregations.scala
---
    @@ -130,3 +142,63 @@ case class Avg(child: Expression) extends Aggregation {
         new SqlAvgAggFunction(AVG)
       }
     }
    +
    +case class UDAGGFunctionCall(
    +    aggregateFunction: AggregateFunction[_, _],
    +    args: Seq[Expression])
    +  extends Aggregation {
    +
    +  override private[flink] def children: Seq[Expression] = args
    +
    +  // Override makeCopy method in TreeNode, to produce vargars properly
    +  override def makeCopy(args: Array[AnyRef]): this.type = {
    +    if (args.length < 1) {
    +      throw new TableException("Invalid constructor params")
    +    }
    +    val agg = args.head.asInstanceOf[AggregateFunction[_, _]]
    +    val arg = args.last.asInstanceOf[Seq[Expression]]
    +    new UDAGGFunctionCall(agg, arg).asInstanceOf[this.type]
    +  }
    +
    +  override def resultType: TypeInformation[_] = TypeExtractor.createTypeInfo(
    --- End diff --
    
    This is again very dangerous. Type extraction fails very often. We should provide a `getResultType`
in `AggregateFunction` that the user can implement.


> Add support to register UDAGG in Table and SQL API
> --------------------------------------------------
>
>                 Key: FLINK-5906
>                 URL: https://issues.apache.org/jira/browse/FLINK-5906
>             Project: Flink
>          Issue Type: Sub-task
>          Components: Table API & SQL
>            Reporter: Fabian Hueske
>            Assignee: Shaoxuan Wang
>




--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message