[
https://issues.apache.org/jira/browse/DRILL-5130?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16050618#comment-16050618
]
Arina Ielchiieva commented on DRILL-5130:
-----------------------------------------
The problem is with incorrectly overridden explainTerms method. This method is
responsible for describing the inputs and attributes of the relational
expression.
In DrillValuesRel this method was incorrectly overriden, in ValuesPrel is was
not overriden at all. Thus two Values nodes with the same row type and row
count were considered to be the same, though their values were different.
During planning Calcite removed discarded duplicated DrillValuesRel and
ValuesPrel (duplicates are found by comparing string representation of two
relational expressions to generate such representation explainTerms is used)
and used the same one for both Values expressions.
Query:
{noformat}
values('a') union all values('b')
{noformat}
Plan:
{noformat}
00-00 Screen
00-01 Project(EXPR$0=[$0])
00-02 UnionAll(all=[true])
00-04 Values
00-03 Values
{noformat}
> UNION ALL difference in results
> -------------------------------
>
> Key: DRILL-5130
> URL: https://issues.apache.org/jira/browse/DRILL-5130
> Project: Apache Drill
> Issue Type: Bug
> Components: Execution - Flow, Query Planning & Optimization
> Affects Versions: 1.9.0
> Reporter: Khurram Faraaz
> Assignee: Arina Ielchiieva
>
> Drill 1.9.0 git commit ID: 51246693
> {noformat}
> 0: jdbc:drill:schema=dfs.tmp> values(1,2,3,4,5,6) union all
> values(7,8,9,10,11,12);
> +---------+---------+---------+---------+---------+---------+
> | EXPR$0 | EXPR$1 | EXPR$2 | EXPR$3 | EXPR$4 | EXPR$5 |
> +---------+---------+---------+---------+---------+---------+
> | 7 | 8 | 9 | 10 | 11 | 12 |
> | 7 | 8 | 9 | 10 | 11 | 12 |
> +---------+---------+---------+---------+---------+---------+
> 2 rows selected (0.209 seconds)
> {noformat}
> Postgres 9.3
> {noformat}
> postgres=# values(1,2,3,4,5,6) union all values(7,8,9,10,11,12);
> column1 | column2 | column3 | column4 | column5 | column6
> ---------+---------+---------+---------+---------+---------
> 1 | 2 | 3 | 4 | 5 | 6
> 7 | 8 | 9 | 10 | 11 | 12
> (2 rows)
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)