You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@drill.apache.org by "Anton Gozhiy (JIRA)" <ji...@apache.org> on 2019/06/06 14:11:00 UTC
[jira] [Created] (DRILL-7286) Joining a table with itself using
subquery results in exception.
Anton Gozhiy created DRILL-7286:
-----------------------------------
Summary: Joining a table with itself using subquery results in exception.
Key: DRILL-7286
URL: https://issues.apache.org/jira/browse/DRILL-7286
Project: Apache Drill
Issue Type: Bug
Affects Versions: 1.16.0
Reporter: Anton Gozhiy
*Steps:*
# Create some test table, like:
{code:sql}
create table t as select * from cp.`employee.json`;
{code}
# Execute the query:
{code:sql}
select * from (select * from t) d1 join t d2 on d1.employee_id = d2.employee_id limit 1;
{code}
*Expected result:*
A result should be returned normally.
*Actual result:*
Exception happened:
{noformat}
Error: SYSTEM ERROR: IndexOutOfBoundsException: index (2) must be less than size (2)
Please, refer to logs for more information.
[Error Id: 92a5ce8e-8640-4636-a897-8f360ddf8ea3 on userf87d-pc:31010]
(org.apache.drill.exec.work.foreman.ForemanException) Unexpected exception during fragment initialization: index (2) must be less than size (2)
org.apache.drill.exec.work.foreman.Foreman.run():305
java.util.concurrent.ThreadPoolExecutor.runWorker():1149
java.util.concurrent.ThreadPoolExecutor$Worker.run():624
java.lang.Thread.run():748
Caused By (java.lang.IndexOutOfBoundsException) index (2) must be less than size (2)
com.google.common.base.Preconditions.checkElementIndex():310
com.google.common.base.Preconditions.checkElementIndex():293
com.google.common.collect.RegularImmutableList.get():67
org.apache.calcite.util.Pair$3.get():295
org.apache.drill.exec.planner.physical.visitor.StarColumnConverter.visitProject():163
org.apache.drill.exec.planner.physical.visitor.StarColumnConverter.visitProject():44
org.apache.drill.exec.planner.physical.ProjectPrel.accept():105
org.apache.drill.exec.planner.physical.visitor.StarColumnConverter.visitPrel():196
org.apache.drill.exec.planner.physical.visitor.StarColumnConverter.visitPrel():44
org.apache.drill.exec.planner.physical.visitor.BasePrelVisitor.visitJoin():51
org.apache.drill.exec.planner.physical.JoinPrel.accept():71
org.apache.drill.exec.planner.physical.visitor.StarColumnConverter.visitPrel():196
org.apache.drill.exec.planner.physical.visitor.StarColumnConverter.visitPrel():44
org.apache.drill.exec.planner.physical.LimitPrel.accept():88
org.apache.drill.exec.planner.physical.visitor.StarColumnConverter.visitPrel():196
org.apache.drill.exec.planner.physical.visitor.StarColumnConverter.visitPrel():44
org.apache.drill.exec.planner.physical.visitor.BasePrelVisitor.visitExchange():46
org.apache.drill.exec.planner.physical.ExchangePrel.accept():36
org.apache.drill.exec.planner.physical.visitor.StarColumnConverter.visitPrel():196
org.apache.drill.exec.planner.physical.visitor.StarColumnConverter.visitPrel():44
org.apache.drill.exec.planner.physical.LimitPrel.accept():88
org.apache.drill.exec.planner.physical.visitor.StarColumnConverter.visitProject():157
org.apache.drill.exec.planner.physical.visitor.StarColumnConverter.visitProject():44
org.apache.drill.exec.planner.physical.ProjectPrel.accept():105
org.apache.drill.exec.planner.physical.visitor.StarColumnConverter.visitScreen():76
org.apache.drill.exec.planner.physical.visitor.StarColumnConverter.visitScreen():44
org.apache.drill.exec.planner.physical.ScreenPrel.accept():65
org.apache.drill.exec.planner.physical.visitor.StarColumnConverter.insertRenameProject():71
org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.convertToPrel():513
org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.getPlan():178
org.apache.drill.exec.planner.sql.DrillSqlWorker.getQueryPlan():226
org.apache.drill.exec.planner.sql.DrillSqlWorker.convertPlan():124
org.apache.drill.exec.planner.sql.DrillSqlWorker.getPlan():90
org.apache.drill.exec.work.foreman.Foreman.runSQL():593
org.apache.drill.exec.work.foreman.Foreman.run():276
java.util.concurrent.ThreadPoolExecutor.runWorker():1149
java.util.concurrent.ThreadPoolExecutor$Worker.run():624
java.lang.Thread.run():748 (state=,code=0)
{noformat}
*Note:* The same query without subquery works fine:
{code:sql}
select * from t d1 join t d2 on d1.employee_id = d2.employee_id limit 1;
{code}
{noformat}
+-------------+--------------+------------+-----------+-------------+----------------+----------+---------------+------------+-----------------------+---------+---------------+-----------------+----------------+--------+-------------------+--------------+--------------+-------------+------------+--------------+-----------------+-----------+----------------+-------------+-----------------------+---------+----------------+------------------+-----------------+---------+-------------------+
| employee_id | full_name | first_name | last_name | position_id | position_title | store_id | department_id | birth_date | hire_date | salary | supervisor_id | education_level | marital_status | gender | management_role | employee_id0 | full_name0 | first_name0 | last_name0 | position_id0 | position_title0 | store_id0 | department_id0 | birth_date0 | hire_date0 | salary0 | supervisor_id0 | education_level0 | marital_status0 | gender0 | management_role0 |
+-------------+--------------+------------+-----------+-------------+----------------+----------+---------------+------------+-----------------------+---------+---------------+-----------------+----------------+--------+-------------------+--------------+--------------+-------------+------------+--------------+-----------------+-----------+----------------+-------------+-----------------------+---------+----------------+------------------+-----------------+---------+-------------------+
| 1 | Sheri Nowmer | Sheri | Nowmer | 1 | President | 0 | 1 | 1961-08-26 | 1994-12-01 00:00:00.0 | 80000.0 | 0 | Graduate Degree | S | F | Senior Management | 1 | Sheri Nowmer | Sheri | Nowmer | 1 | President | 0 | 1 | 1961-08-26 | 1994-12-01 00:00:00.0 | 80000.0 | 0 | Graduate Degree | S | F | Senior Management |
+-------------+--------------+------------+-----------+-------------+----------------+----------+---------------+------------+-----------------------+---------+---------------+-----------------+----------------+--------+-------------------+--------------+--------------+-------------+------------+--------------+-----------------+-----------+----------------+-------------+-----------------------+---------+----------------+------------------+-----------------+---------+-------------------+
1 row selected (0.263 seconds)
{noformat}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)