drill-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aman Sinha (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (DRILL-2523) Correlated subquery with group by and count(<column name>) throws unclear error
Date Thu, 02 Jul 2015 18:56:06 GMT

     [ https://issues.apache.org/jira/browse/DRILL-2523?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Aman Sinha updated DRILL-2523:
------------------------------
    Fix Version/s:     (was: 1.2.0)
                   1.3.0

> Correlated subquery with group by and count(<column name>) throws unclear error
> -------------------------------------------------------------------------------
>
>                 Key: DRILL-2523
>                 URL: https://issues.apache.org/jira/browse/DRILL-2523
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Query Planning & Optimization
>    Affects Versions: 0.8.0
>            Reporter: Victoria Markman
>            Assignee: Aman Sinha
>             Fix For: 1.3.0
>
>         Attachments: t1.parquet, t2.parquet
>
>
> Correlated subquery: works, returns correct result
> {code}
> 0: jdbc:drill:schema=dfs> select * from t2 where a2 not in ( select a1 from t1 where
t2.b2 = t1.b1 );
> +------------+------------+------------+
> |     a2     |     b2     |     c2     |
> +------------+------------+------------+
> | 0          | zzz        | 2014-12-31 |
> | 4          | ddddd      | 2015-01-04 |
> +------------+------------+------------+
> 2 rows selected (4.893 seconds)
> {code}
> count (\*) works
> {code}
> 0: jdbc:drill:schema=dfs> select t2.c2, count(*) from t2 where a2 not in ( select
a1 from t1 where t2.b2 = t1.b1 ) group by t2.c2 order by t2.c2;
> +------------+------------+
> |     c2     |   EXPR$1   |
> +------------+------------+
> | 2014-12-31 | 1          |
> | 2015-01-04 | 1          |
> +------------+------------+
> 2 rows selected (1.201 seconds) 
> {code}
> count(<column name>) does not work and throws an error.
> Postgres returns result in this case. I'm not sure what is wrong with this query and
error does not tell me anything ....
> {code}
> 0: jdbc:drill:schema=dfs> select t2.c2, count(t2.b2) from t2 where a2 not in ( select
a1 from t1 where t2.b2 = t1.b1 ) group by t2.c2 order by t2.c2;
> Query failed: IllegalArgumentException: Target must be less than target count, 2
> Error: exception while executing query: Failure while executing query. (state=,code=0)
> {code}
> drillbit.log
> {code}
> 2015-03-23 18:07:30,799 [2aefa99c-d961-f2c2-29a2-f2265d0b72a6:foreman] ERROR o.a.drill.exec.work.foreman.Foreman
- Error 7e9910d4-9302-4b2c-9463-689b67f15601: IllegalArgumentException: Target must be less
than target count, 2
> org.apache.drill.exec.work.foreman.ForemanException: Unexpected exception during fragment
initialization: Target must be less than target count, 2
>         at org.apache.drill.exec.work.foreman.Foreman.run(Foreman.java:211) [drill-java-exec-0.8.0-SNAPSHOT-rebuffed.jar:0.8.0-SNAPSHOT]
>         at org.apache.drill.common.SelfCleaningRunnable.run(SelfCleaningRunnable.java:38)
[drill-common-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.IllegalArgumentException: Target must be less than target count,
2
>         at org.eigenbase.util.mapping.Mappings$PartialFunctionImpl.set(Mappings.java:1374)
~[optiq-core-0.9-drill-r20.jar:na]
>         at org.eigenbase.util.mapping.Mappings.target(Mappings.java:266) ~[optiq-core-0.9-drill-r20.jar:na]
>         at org.eigenbase.sql2rel.RelDecorrelator.decorrelateRel(RelDecorrelator.java:304)
~[optiq-core-0.9-drill-r20.jar:na]
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_71]
>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
~[na:1.7.0_71]
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
~[na:1.7.0_71]
>         at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_71]
>         at org.eigenbase.util.ReflectUtil.invokeVisitorInternal(ReflectUtil.java:252)
~[optiq-core-0.9-drill-r20.jar:na]
>         at org.eigenbase.util.ReflectUtil.invokeVisitor(ReflectUtil.java:209) ~[optiq-core-0.9-drill-r20.jar:na]
>         at org.eigenbase.util.ReflectUtil$1.invokeVisitor(ReflectUtil.java:473) ~[optiq-core-0.9-drill-r20.jar:na]
>         at org.eigenbase.sql2rel.RelDecorrelator$DecorrelateRelVisitor.visit(RelDecorrelator.java:1372)
~[optiq-core-0.9-drill-r20.jar:na]
>         at org.eigenbase.sql2rel.RelDecorrelator.decorrelate(RelDecorrelator.java:135)
~[optiq-core-0.9-drill-r20.jar:na]
>         at org.eigenbase.sql2rel.SqlToRelConverter.decorrelateQuery(SqlToRelConverter.java:2618)
~[optiq-core-0.9-drill-r20.jar:na]
>         at org.eigenbase.sql2rel.SqlToRelConverter.decorrelate(SqlToRelConverter.java:363)
~[optiq-core-0.9-drill-r20.jar:na]
>         at net.hydromatic.optiq.prepare.PlannerImpl.convert(PlannerImpl.java:189) ~[optiq-core-0.9-drill-r20.jar:na]
>         at org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.convertToRel(DefaultSqlHandler.java:175)
~[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:735) [drill-java-exec-0.8.0-SNAPSHOT-rebuffed.jar:0.8.0-SNAPSHOT]
>         at org.apache.drill.exec.work.foreman.Foreman.run(Foreman.java:202) [drill-java-exec-0.8.0-SNAPSHOT-rebuffed.jar:0.8.0-SNAPSHOT]
>         ... 4 common frames omitted
> {code}



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

Mime
View raw message