[
https://issues.apache.org/jira/browse/DRILL-4700?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Miguel Lamy updated DRILL-4700:
-------------------------------
Summary: physical plan in multiple Unions with jdbc storage with derived
table without alias (was: physical plan in multiple Unions with jdbc storage
with derived without alias)
> physical plan in multiple Unions with jdbc storage with derived table without
> alias
> -----------------------------------------------------------------------------------
>
> Key: DRILL-4700
> URL: https://issues.apache.org/jira/browse/DRILL-4700
> Project: Apache Drill
> Issue Type: Bug
> Components: SQL Parser, Storage - JDBC
> Affects Versions: 1.6.0
> Reporter: Miguel Lamy
>
> The problem occurs when there is more than one union in the query using jdbc
> storage.
> This query works:
> 0: jdbc:drill:zk=local> select 0 a from (values(1))
> . . . . . . . . . . . > union all
> . . . . . . . . . . . > select 1 a from (values(1))
> . . . . . . . . . . . > union all
> . . . . . . . . . . . > select 2 a from (values(1));
> +----+
> | a |
> +----+
> | 0 |
> | 1 |
> | 2 |
> +----+
> This query using mysql storage or mssql storage doesn't work:
> 0: jdbc:drill:zk=local> select 0 as ChvOutTerc from ProcessarReceita procrec0
> . . . . . . . . . . . > union all
> . . . . . . . . . . . > select 1 as ChvOutTerc from ProcessarReceita procrec1
> . . . . . . . . . . . > union all
> . . . . . . . . . . . > select 2 as ChvOutTerc from ProcessarReceita
> procrec2;
> Error: DATA_READ ERROR: The JDBC storage plugin failed while trying setup the
> SQL query.
> sql SELECT *
> FROM (SELECT 0 AS "ChvOutTerc"
> FROM "dbo"."ProcessarReceita"
> UNION ALL
> SELECT 1 AS "ChvOutTerc"
> FROM "dbo"."ProcessarReceita")
> UNION ALL
> SELECT 2 AS "ChvOutTerc"
> FROM "dbo"."ProcessarReceita"
> plugin siag_enidh
> Fragment 0:0
> [Error Id: f3afa6ce-895c-4aa3-bfda-b769e4795ae1 on hefesto.siag.pt:31010]
> (state=,code=0)
> Changing the physical plan to include an alias on derived table and then
> executing that physical plan works without problem:
> SELECT *
> FROM (SELECT 0 AS "ChvOutTerc"
> FROM "dbo"."ProcessarReceita"
> UNION ALL
> SELECT 1 AS "ChvOutTerc"
> FROM "dbo"."ProcessarReceita") mytable
> UNION ALL
> SELECT 2 AS "ChvOutTerc"
> FROM "dbo"."ProcessarReceita"
> Also tested with 1.7.0-SNAPSHOT (20160531) with the same results.
> Results with just one union:
> 0: jdbc:drill:zk=local> select 0 as ChvOutTerc from ProcessarReceita procrec0
> . . . . . . . . . . . > union all
> . . . . . . . . . . . > select 1 as ChvOutTerc from ProcessarReceita
> procrec1 limit 3;
> +-------------+
> | ChvOutTerc |
> +-------------+
> | 0 |
> | 0 |
> | 0 |
> +-------------+
> 3 rows selected (0.708 seconds)
> 0: jdbc:drill:zk=local> select 1 as ChvOutTerc from ProcessarReceita procrec1
> . . . . . . . . . . . > union all
> . . . . . . . . . . . > select 2 as ChvOutTerc from ProcessarReceita
> procrec2 limit 3;
> +-------------+
> | ChvOutTerc |
> +-------------+
> | 1 |
> | 1 |
> | 1 |
> +-------------+
> 3 rows selected (0.449 seconds)
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)