In WHERE clause, Hive failed to resolve alias for subquery with join(s)
-----------------------------------------------------------------------

                 Key: HIVE-915
                 URL: https://issues.apache.org/jira/browse/HIVE-915
             Project: Hadoop Hive
          Issue Type: Bug
          Components: Query Processor
    Affects Versions: 0.4.0
         Environment: Hadoop v0.20.1
Latest code from Hive branch-0.4
Linux OS (both 32bit & 64bit)
            Reporter: Nhan Nguyen
            Priority: Critical


When executing the below query

FROM (SELECT ip, country, count(1) AS total FROM eventlog WHERE 
prt_date=20091022 GROUP BY ip, country) t1 JOIN bot_ip t2 ON t1.ip=t2.ip
SELECT t1.ip, t1.country
WHERE t1.total>0;

I got "FAILED: Unknown exception : null" 

WHERE clause will not know about the alias t1.

And below is the stack trace
2009-11-06 11:03:12,776 ERROR ql.Driver (SessionState.java:printError(279)) - 
FAILED: Unknown exception : null
java.lang.NullPointerException
        at 
org.apache.hadoop.hive.ql.parse.QBMetaData.getTableForAlias(QBMetaData.java:76)
        at 
org.apache.hadoop.hive.ql.parse.ASTPartitionPruner.getTableColumnDesc(ASTPartitionPruner.java:298)
        at 
org.apache.hadoop.hive.ql.parse.ASTPartitionPruner.genExprNodeDesc(ASTPartitionPruner.java:220)
        at 
org.apache.hadoop.hive.ql.parse.ASTPartitionPruner.genExprNodeDesc(ASTPartitionPruner.java:234)
        at 
org.apache.hadoop.hive.ql.parse.ASTPartitionPruner.genExprNodeDesc(ASTPartitionPruner.java:234)
        at 
org.apache.hadoop.hive.ql.parse.ASTPartitionPruner.genExprNodeDesc(ASTPartitionPruner.java:234)
        at 
org.apache.hadoop.hive.ql.parse.ASTPartitionPruner.addExpression(ASTPartitionPruner.java:397)
        at 
org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPartitionPruners(SemanticAnalyzer.java:624)
        at 
org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.analyzeInternal(SemanticAnalyzer.java:4440)
        at 
org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer.analyze(BaseSemanticAnalyzer.java:76)
        at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:249)
        at org.apache.hadoop.hive.ql.Driver.run(Driver.java:281)
        at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:123)
        at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:181)
        at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:287)
        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:156)

It runs fine when omitting WHERE clause or WHERE clause doesn't reference to 
any column of t1. It also runs fine if I make no join.

This is critical as sub-query is the current work-around for the unsupported 
HAVING clause.

Hope this gets fixed soon.

Thanks

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to