Uploaded image for project: 'Phoenix'
  1. Phoenix
  2. PHOENIX-3505

Potential NullPointerException on close() in OrderedResultIterator

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 4.10.0, 4.8.3
    • None
    • None

    Description

      I observed a NPE in executing query 10 from TPC-H over a Phoenix-4.7ish version at $dayjob.

      select
      	c_custkey,
      	c_name,
      	sum(l_extendedprice*(1 - l_discount)) as revenue,
      	c_acctbal,
      	n_name,
      	c_address,
      	c_phone,
      	c_comment
      from
      	customer,
      	orders,
      	lineitem,
      	nation
      where
      	c_custkey = o_custkey
      	and l_orderkey = o_orderkey
      	and o_orderdate >= to_date('1993-07-01')
      	and o_orderdate < to_date('1993-10-01')
      	and l_returnflag = 'R'
      	and c_nationkey = n_nationkey
      group by
      	c_custkey,
      	c_name,
      	c_acctbal,
      	c_phone,
      	n_name,
      	c_address,
      	c_comment
      order by
      	revenue desc
      

      DDL are:

      CREATE TABLE NATION  ( N_NATIONKEY  INTEGER NOT NULL,
                                  N_NAME       CHAR(25) NOT NULL,
                                  N_REGIONKEY  INTEGER NOT NULL,
                                  N_COMMENT    VARCHAR(152));
      
      
      CREATE TABLE CUSTOMER ( C_CUSTKEY     INTEGER NOT NULL,
                                   C_NAME        VARCHAR(25) NOT NULL,
                                   C_ADDRESS     VARCHAR(40) NOT NULL,
                                   C_NATIONKEY   INTEGER NOT NULL,
                                   C_PHONE       CHAR(15) NOT NULL,
                                   C_ACCTBAL     DECIMAL(15,2)   NOT NULL,
                                   C_MKTSEGMENT  CHAR(10) NOT NULL,
                                   C_COMMENT     VARCHAR(117) NOT NULL);
      
      CREATE TABLE ORDERS  ( O_ORDERKEY       INTEGER NOT NULL,
                                 O_CUSTKEY        INTEGER NOT NULL,
                                 O_ORDERSTATUS    CHAR(1) NOT NULL,
                                 O_TOTALPRICE     DECIMAL(15,2) NOT NULL,
                                 O_ORDERDATE      DATE NOT NULL,
                                 O_ORDERPRIORITY  CHAR(15) NOT NULL,  
                                 O_CLERK          CHAR(15) NOT NULL, 
                                 O_SHIPPRIORITY   INTEGER NOT NULL,
                                 O_COMMENT        VARCHAR(79) NOT NULL);
      
      CREATE TABLE LINEITEM ( L_ORDERKEY    INTEGER NOT NULL,
                                   L_PARTKEY     INTEGER NOT NULL,
                                   L_SUPPKEY     INTEGER NOT NULL,
                                   L_LINENUMBER  INTEGER NOT NULL,
                                   L_QUANTITY    DECIMAL(15,2) NOT NULL,
                                   L_EXTENDEDPRICE  DECIMAL(15,2) NOT NULL,
                                   L_DISCOUNT    DECIMAL(15,2) NOT NULL,
                                   L_TAX         DECIMAL(15,2) NOT NULL,
                                   L_RETURNFLAG  CHAR(1) NOT NULL,
                                   L_LINESTATUS  CHAR(1) NOT NULL,
                                   L_SHIPDATE    DATE NOT NULL,
                                   L_COMMITDATE  DATE NOT NULL,
                                   L_RECEIPTDATE DATE NOT NULL,
                                   L_SHIPINSTRUCT CHAR(25) NOT NULL,
                                   L_SHIPMODE     CHAR(10) NOT NULL,
                                   L_COMMENT VARCHAR(44) NOT NULL);
      

      We ultimately got a NullPointerException trying to close the PhoenixStatement down in OrderedResultIterator. The only execution path I can come up with is that the Iterator was constructor but next() or peek() were never called (for whatever reason). Calling close() at this point would result in an NPE being thrown.

      Attachments

        1. PHOENIX-3505.001.patch
          3 kB
          Josh Elser

        Activity

          People

            elserj Josh Elser
            santhoshbg Santhosh B Gowda
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: