From issues-return-185360-archive-asf-public=cust-asf.ponee.io@flink.apache.org Mon Aug 20 16:02:34 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 338B31807A6 for ; Mon, 20 Aug 2018 16:02:33 +0200 (CEST) Received: (qmail 63036 invoked by uid 500); 20 Aug 2018 14:02:31 -0000 Mailing-List: contact issues-help@flink.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flink.apache.org Delivered-To: mailing list issues@flink.apache.org Received: (qmail 62732 invoked by uid 99); 20 Aug 2018 14:02:31 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Aug 2018 14:02:31 +0000 From: GitBox To: issues@flink.apache.org Subject: [GitHub] fhueske commented on a change in pull request #6521: [FLINK-5315][table] Adding support for distinct operation for table API on DataStream Message-ID: <153477375074.27734.3373766513771849225.gitbox@gitbox.apache.org> Date: Mon, 20 Aug 2018 14:02:30 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit fhueske commented on a change in pull request #6521: [FLINK-5315][table] Adding support for distinct operation for table API on DataStream URL: https://github.com/apache/flink/pull/6521#discussion_r211270531 ########## File path: flink-libraries/flink-table/src/main/scala/org/apache/flink/table/functions/AggregateFunction.scala ########## @@ -136,4 +138,12 @@ abstract class AggregateFunction[T, ACC] extends UserDefinedFunction { * accumulator type should be automatically inferred. */ def getAccumulatorType: TypeInformation[ACC] = null + + /** + * Returns an aggregation function that requires distinct accumulator. + * @return distinct aggregate version of the [[AggregateFunction]]. + */ + private[flink] def distinct: DistinctAggregateFunction[T, ACC] = DistinctAggregateFunction(this) } + +private[flink] case class DistinctAggregateFunction[T, ACC](aggFunction: AggregateFunction[T, ACC]) Review comment: Extend this class to ``` private[flink] case class DistinctAggregateFunction[T: TypeInformation, ACC: TypeInformation] (aggFunction: AggregateFunction[T, ACC]) { private[flink] def distinct(params: Expression*): Expression = { val resultTypeInfo: TypeInformation[_] = getResultTypeOfAggregateFunction( aggFunction, implicitly[TypeInformation[T]]) val accTypeInfo: TypeInformation[_] = getAccumulatorTypeOfAggregateFunction( aggFunction, implicitly[TypeInformation[ACC]]) DistinctAgg( AggFunctionCall(aggFunction, resultTypeInfo, accTypeInfo, params)) } } ``` and move it to a separate file. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org With regards, Apache Git Services