Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-6208

user-defined aggregate functions cannot be used as windowing function

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.13.0
    • Component/s: UDF
    • Labels:
      None

      Description

      Function registry does a pass to register all GenericUDAFs as window functions. However any aggregate functions added after this (such as a user-added temporary function) don't work as window functions:

      hive> create temporary function mysum as 'org.apache.hadoop.hive.ql.udf.generic.GenericUDAFSum';
      OK
      Time taken: 0.0050 seconds
      hive> explain select mysum(key) over () from src;
      FAILED: NullPointerException null

      java.lang.NullPointerException
      at org.apache.hadoop.hive.ql.parse.PTFTranslator.translate(PTFTranslator.java:354)
      at org.apache.hadoop.hive.ql.parse.PTFTranslator.translate(PTFTranslator.java:194)
      at org.apache.hadoop.hive.ql.parse.WindowingComponentizer.next(WindowingComponentizer.java:86)
      at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genWindowingPlan(SemanticAnalyzer.java:10721)
      at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPostGroupByBodyPlan(SemanticAnalyzer.java:7904)
      at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genBodyPlan(SemanticAnalyzer.java:7862)
      at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:8678)
      at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.analyzeInternal(SemanticAnalyzer.java:8904)
      at org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer.analyze(BaseSemanticAnalyzer.java:310)
      at org.apache.hadoop.hive.ql.parse.ExplainSemanticAnalyzer.analyzeInternal(ExplainSemanticAnalyzer.java:65)
      at org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer.analyze(BaseSemanticAnalyzer.java:310)
      at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:440)
      at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:340)
      at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:996)
      at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1039)
      at org.apache.hadoop.hive.ql.Driver.run(Driver.java:932)
      at org.apache.hadoop.hive.ql.Driver.run(Driver.java:922)
      at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:268)
      at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:220)
      at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:424)
      at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:792)
      at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:686)
      at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:625)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.apache.hadoop.util.RunJar.main(RunJar.java:212)

        Attachments

          Activity

            People

            • Assignee:
              jdere Jason Dere
              Reporter:
              jdere Jason Dere
            • Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: