hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mich Talebzadeh" <>
Subject RE: NPE from simple nested ANSI Join
Date Fri, 05 Feb 2016 09:17:30 GMT
Hi Dave,


Your schema looks like this




I have a similar schema with the following relationship




I tried this one and it works both in Hive 1.2.1 and Spark getting total sales for each country


SELECT c.country_name AS nation,

       sum (amount_sold) AS salesamount

FROM  countries c

INNER JOIN customers cs

ON c.country_id = cs.country_id

INNER JOIN sales s

ON cs.cust_id = s.cust_id

GROUP BY country_name

ORDER BY country_name


It works OK




Dr Mich Talebzadeh


LinkedIn   <>


Sybase ASE 15 Gold Medal Award 2008

A Winning Strategy: Running the most Critical Financial Data on ASE 15


Author of the books "A Practitioner’s Guide to Upgrading to Sybase ASE 15", ISBN 978-0-9563693-0-7.

co-author "Sybase Transact SQL Guidelines Best Practices", ISBN 978-0-9759693-0-4

Publications due shortly:

Complex Event Processing in Heterogeneous Environments, ISBN: 978-0-9563693-3-8

Oracle and Sybase, Concepts and Contrasts, ISBN: 978-0-9563693-1-4, volume one out shortly




NOTE: The information in this email is proprietary and confidential. This message is for the
designated recipient only, if you are not the intended recipient, you should destroy it immediately.
Any information in this message shall not be understood as given or endorsed by Peridale Technology
Ltd, its subsidiaries or their employees, unless expressly so stated. It is the responsibility
of the recipient to ensure that this email is virus free, therefore neither Peridale Technology
Ltd, its subsidiaries nor their employees accept any responsibility.


From: Dave Nicodemus [] 
Sent: 04 February 2016 19:29
Subject: NPE from simple nested ANSI Join


Using hive  Connecting using JDBC, issuing the following query : 



FROM nation n 

    INNER JOIN (customer c

                         INNER JOIN orders o ON c.c_custkey = o.o_custkey)

     ON n.n_nationkey = c.c_nationkey;


Generates the NPE and stack below. Fields are integer data type


Does anyone know if this is a known issue  and whether it's fixed someplace ?







Caused by: java.lang.NullPointerExcEeption: Remote java.lang.NullPointerException: null

        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.isPresent(
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.parseJoinCondPopulateAlias(
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.parseJoinCondPopulateAlias(
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.parseJoinCondition(
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.parseJoinCondition(
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genJoinTree(
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genJoinTree(
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genOPTree(
        at org.apache.hadoop.hive.ql.parse.CalcitePlanner.genOPTree(
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.analyzeInternal(
        at org.apache.hadoop.hive.ql.parse.CalcitePlanner.analyzeInternal(
        at org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer.analyze(
        at org.apache.hadoop.hive.ql.Driver.compile(
        at org.apache.hadoop.hive.ql.Driver.compile(
        at org.apache.hadoop.hive.ql.Driver.compileInternal(
        at org.apache.hadoop.hive.ql.Driver.compileAndRespond(
        at org.apache.hive.service.cli.operation.SQLOperation.prepare(




View raw message