You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by fhueske <gi...@git.apache.org> on 2017/06/26 15:35:55 UTC

[GitHub] flink pull request #3783: [FLINK-6388] Add support for DISTINCT into Code Ge...

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

    https://github.com/apache/flink/pull/3783#discussion_r124033513
  
    --- Diff: flink-libraries/flink-table/src/main/scala/org/apache/flink/table/codegen/CodeGenerator.scala ---
    @@ -335,15 +371,30 @@ class CodeGenerator(
             j"""
                 |  public final void accumulate(
                 |    org.apache.flink.types.Row accs,
    -            |    org.apache.flink.types.Row input)""".stripMargin
    +            |    org.apache.flink.types.Row input) throws Exception""".stripMargin
     
    +      val distAggsFlags: Array[Boolean] = distinctAggsFlags.getOrElse(new Array[Boolean](0))    
           val accumulate: String = {
             for (i <- aggs.indices) yield
    -          j"""
    -             |    ${aggs(i)}.accumulate(
    -             |      ((${accTypes(i)}) accs.getField($i)),
    -             |      ${parameters(i)});""".stripMargin
    -      }.mkString("\n")
    +          if (distinctAggsFlags.isDefined && distAggsFlags(i)){
    +            j"""
    +               |  Long distValCount$i = (Long) distStateList[$i].get(${parameters(i)});
    --- End diff --
    
    We need to put the parameters into a tuple before accessing the map state. The tuple should be reused.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---