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

Cartesian join fails if the query has an empty table when cartesian product edge is used

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • Hive, Tez
    • None

    Description

      The following example fails when "hive.tez.cartesian-product.enabled" is true - 
      Test command - 

      mvn test -Dtest=TestMiniLlapCliDriver -Dqfile=file.q -Dtest.output.overwrite=true 

      Query - file.q

      set hive.tez.cartesian-product.enabled=true;
      
      create table c (a1 int) stored as orc;
      create table tmp1 (a int) stored as orc;
      create table tmp2 (a int) stored as orc;
      
      insert into table c values (3);
      insert into table tmp1 values (3);
      
      with
      first as (
      select a1 from c where a1 = 3
      ),
      second as (
      select a from tmp1
      union all
      select a from tmp2
      )
      select a from second cross join first; 

      The following stack trace is seen - 

      Caused by: java.lang.IllegalArgumentException: Number of items is 0. Should be positive
              at org.apache.tez.common.Preconditions.checkArgument(Preconditions.java:38)
              at org.apache.tez.runtime.library.utils.Grouper.init(Grouper.java:41)
              at org.apache.tez.runtime.library.cartesianproduct.FairCartesianProductEdgeManager.initialize(FairCartesianProductEdgeManager.java:66)
              at org.apache.tez.runtime.library.cartesianproduct.CartesianProductEdgeManager.initialize(CartesianProductEdgeManager.java:51)
              at org.apache.tez.dag.app.dag.impl.Edge.initialize(Edge.java:213)
              ... 22 more

      The following error is seen because one of the tables (tmp2 in this case) has 0 rows in it. 

      The query works fine when the config hive.tez.cartesian-product.enabled is set to false.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              sbadhya Sourabh Badhya
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated: