You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@drill.apache.org by "Victoria Markman (JIRA)" <ji...@apache.org> on 2015/01/05 22:28:34 UTC

[jira] [Created] (DRILL-1930) Unexpected exception with subquery returning numeric value instead of boolean type and one more condition present

Victoria Markman created DRILL-1930:
---------------------------------------

             Summary: Unexpected exception with subquery returning numeric value instead of boolean type and one more condition present
                 Key: DRILL-1930
                 URL: https://issues.apache.org/jira/browse/DRILL-1930
             Project: Apache Drill
          Issue Type: Bug
    Affects Versions: 0.8.0
            Reporter: Victoria Markman


{code}
#Fri Jan 02 21:20:47 EST 2015
git.commit.id.abbrev=b491cdb
{code}

I was debugging TPCDS query failure and ran into this failure below:

{code}
select  a.ca_state state,
        count(*) cnt
from    customer_address a
        ,item i
where
        (select distinct (d.d_month_seq)
         from   date_dim d
         where  d.d_year = 1998
                and d.d_moy = 5 )
                and i.i_current_price > 1.2
group by a.ca_state;

2015-01-05 21:10:51,561 [2b550223-9064-c659-d27e-3329af3718b8:foreman] ERROR o.a.drill.exec.work.foreman.Foreman - Error 2a72168b-c23e-485b-97fd-4644aa65dbc0: Query failed: Unexpected exception during fragment initialization: Internal error: Error while applying rule DrillPushFilterPastProjectRule, args [rel#6321:FilterRel.NONE.ANY([]).[](child=rel#6320:Subset#16.NONE.ANY([]).[],condition=$1), rel#6317:ProjectRel.NONE.ANY([]).[](child=rel#6315:Subset#15.NONE.ANY([]).[],ca_state=$1,$f0=$4)]
org.apache.drill.exec.work.foreman.ForemanException: Unexpected exception during fragment initialization: Internal error: Error while applying rule DrillPushFilterPastProjectRule, args [rel#6321:FilterRel.NONE.ANY([]).[](child=rel#6320:Subset#16.NONE.ANY([]).[],condition=$1), rel#6317:ProjectRel.NONE.ANY([]).[](child=rel#6315:Subset#15.NONE.ANY([]).[],ca_state=$1,$f0=$4)]
        at org.apache.drill.exec.work.foreman.Foreman.run(Foreman.java:194) [drill-java-exec-0.8.0-SNAPSHOT-rebuffed.jar:0.8.0-SNAPSHOT]
        at org.apache.drill.exec.work.WorkManager$RunnableWrapper.run(WorkManager.java:254) [drill-java-exec-0.8.0-SNAPSHOT-rebuffed.jar:0.8.0-SNAPSHOT]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_71]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_71]
        at java.lang.Thread.run(Thread.java:745) [na:1.7.0_71]
Caused by: java.lang.AssertionError: Internal error: Error while applying rule DrillPushFilterPastProjectRule, args [rel#6321:FilterRel.NONE.ANY([]).[](child=rel#6320:Subset#16.NONE.ANY([]).[],condition=$1), rel#6317:ProjectRel.NONE.ANY([]).[](child=rel#6315:Subset#15.NONE.ANY([]).[],ca_state=$1,$f0=$4)]
        at org.eigenbase.util.Util.newInternal(Util.java:750) ~[optiq-core-0.9-drill-r16.jar:na]
        at org.eigenbase.relopt.volcano.VolcanoRuleCall.onMatch(VolcanoRuleCall.java:246) ~[optiq-core-0.9-drill-r16.jar:na]
        at org.eigenbase.relopt.volcano.VolcanoPlanner.findBestExp(VolcanoPlanner.java:661) ~[optiq-core-0.9-drill-r16.jar:na]
        at net.hydromatic.optiq.tools.Programs$RuleSetProgram.run(Programs.java:165) ~[optiq-core-0.9-drill-r16.jar:na]
        at net.hydromatic.optiq.prepare.PlannerImpl.transform(PlannerImpl.java:273) ~[optiq-core-0.9-drill-r16.jar:na]
        at org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.convertToDrel(DefaultSqlHandler.java:155) ~[drill-java-exec-0.8.0-SNAPSHOT-rebuffed.jar:0.8.0-SNAPSHOT]
        at org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.getPlan(DefaultSqlHandler.java:134) ~[drill-java-exec-0.8.0-SNAPSHOT-rebuffed.jar:0.8.0-SNAPSHOT]
        at org.apache.drill.exec.planner.sql.DrillSqlWorker.getPlan(DrillSqlWorker.java:145) ~[drill-java-exec-0.8.0-SNAPSHOT-rebuffed.jar:0.8.0-SNAPSHOT]
        at org.apache.drill.exec.work.foreman.Foreman.runSQL(Foreman.java:507) [drill-java-exec-0.8.0-SNAPSHOT-rebuffed.jar:0.8.0-SNAPSHOT]
        at org.apache.drill.exec.work.foreman.Foreman.run(Foreman.java:185) [drill-java-exec-0.8.0-SNAPSHOT-rebuffed.jar:0.8.0-SNAPSHOT]
        ... 4 common frames omitted
Caused by: java.lang.AssertionError: condition must be boolean
        at org.eigenbase.rex.RexProgram.isValid(RexProgram.java:460) ~[optiq-core-0.9-drill-r16.jar:na]
        at org.eigenbase.rex.RexProgram.<init>(RexProgram.java:102) ~[optiq-core-0.9-drill-r16.jar:na]
        at org.eigenbase.rex.RexProgramBuilder.getProgram(RexProgramBuilder.java:395) ~[optiq-core-0.9-drill-r16.jar:na]
        at org.eigenbase.rex.RexProgramBuilder.getProgram(RexProgramBuilder.java:392) ~[optiq-core-0.9-drill-r16.jar:na]
        at org.eigenbase.rex.RexProgramBuilder.getProgram(RexProgramBuilder.java:365) ~[optiq-core-0.9-drill-r16.jar:na]
        at org.eigenbase.relopt.RelOptUtil.pushFilterPastProject(RelOptUtil.java:2180) ~[optiq-core-0.9-drill-r16.jar:na]
        at org.apache.drill.exec.planner.logical.DrillPushFilterPastProjectRule.onMatch(DrillPushFilterPastProjectRule.java:101) ~[drill-java-exec-0.8.0-SNAPSHOT-rebuffed.jar:0.8.0-SNAPSHOT]
        at org.eigenbase.relopt.volcano.VolcanoRuleCall.onMatch(VolcanoRuleCall.java:223) ~[optiq-core-0.9-drill-r16.jar:na]
        ... 12 common frames omitted
{code}

If you comment out the second filter, you get correct error that we should have received in the first place (more or less).

{code}0: jdbc:drill:schema=dfs> select  a.ca_state state,
. . . . . . . . . . . . >         count(*) cnt
. . . . . . . . . . . . > from    customer_address a
. . . . . . . . . . . . >         ,item i
. . . . . . . . . . . . > where
. . . . . . . . . . . . >         (select distinct (d.d_month_seq)
. . . . . . . . . . . . >          from   date_dim d
. . . . . . . . . . . . >          where  d.d_year = 1998
. . . . . . . . . . . . >                 and d.d_moy = 5 )
. . . . . . . . . . . . >                 --and i.i_current_price > 1.2
. . . . . . . . . . . . > group by a.ca_state;
Query failed: Query failed: Failure validating SQL. org.eigenbase.util.EigenbaseContextException: From line 6, column 10 to line 9, column 31: WHERE clause must be a condition
{code}

Here is what postgres returns in such a case:
{code}
postgres=# select * from t1 where (select distinct a2 from t2);
ERROR:  argument of WHERE must be type boolean, not type integer
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)