Sharanya Santhanam created HIVE-17379:
-----------------------------------------

             Summary: Null Pointer Exception in WHERE clause when using 
aggregate function as a filter  
                 Key: HIVE-17379
                 URL: https://issues.apache.org/jira/browse/HIVE-17379
             Project: Hive
          Issue Type: Bug
          Components: Query Processor
    Affects Versions: 2.1.1
            Reporter: Sharanya Santhanam



Sample Query : 

with tableAAlias as (
   select a, count(*)  as acount
   from tableA
   groupBy a 

)

select a.a, b.b 
from tableB as b JOIN 
tableAAlias a
on a.a=b.a
where a.acount > 10 

FAILED: NullPointerException null
java.lang.NullPointerException
at 
org.apache.hadoop.hive.ql.optimizer.ColumnPrunerProcFactory$ColumnPrunerFilterProc.process(ColumnPrunerProcFactory.java:103)
at 
org.apache.hadoop.hive.ql.lib.DefaultRuleDispatcher.dispatch(DefaultRuleDispatcher.java:90)
at 
org.apache.hadoop.hive.ql.lib.DefaultGraphWalker.dispatchAndReturn(DefaultGraphWalker.java:105)
at 
org.apache.hadoop.hive.ql.lib.DefaultGraphWalker.dispatch(DefaultGraphWalker.java:89)
at 
org.apache.hadoop.hive.ql.optimizer.ColumnPruner$ColumnPrunerWalker.walk(ColumnPruner.java:176)
at 
org.apache.hadoop.hive.ql.lib.DefaultGraphWalker.startWalking(DefaultGraphWalker.java:120)
at 
org.apache.hadoop.hive.ql.optimizer.ColumnPruner.transform(ColumnPruner.java:136)
at org.apache.hadoop.hive.ql.optimizer.Optimizer.optimize(Optimizer.java:246)
at 
org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.analyzeInternal(SemanticAnalyzer.java:11149)
at 
org.apache.hadoop.hive.ql.parse.CalcitePlanner.analyzeInternal(CalcitePlanner.java:246)
at 
org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer.analyze(BaseSemanticAnalyzer.java:264)
at 
org.apache.hadoop.hive.ql.parse.ExplainSemanticAnalyzer.analyzeInternal(ExplainSemanticAnalyzer.java:80)
at 
org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer.analyze(BaseSemanticAnalyzer.java:264)
at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:490)
at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1270)
at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1412)
at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1199)
at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1189)
at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:265)
at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:210)
at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:444)
at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:376)
at org.apache.hadoop.hive.cli.CliDriver.processReader(CliDriver.java:474)
at org.apache.hadoop.hive.cli.CliDriver.processFile(CliDriver.java:514)
at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:882)
at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:836)
at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:732)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.hadoop.util.RunJar.run(RunJar.java:223)
at org.apache.hadoop.util.RunJar.main(RunJar.java:136)


The above Query Succeeds if it is modified as : 

select a.a, b.b , *a.acount*
from tableB as b JOIN 
tableAAlias a
on a.a=b.a
where a.acount > 10 


Please Note the original query worked on hive1.2 & breaks on Hive2.1.1 



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to