[
https://issues.apache.org/jira/browse/DRILL-1889?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14277756#comment-14277756
]
Jinfeng Ni commented on DRILL-1889:
-----------------------------------
The cause of this wrong result for select * query is that Drill's plan
currently does not distinguish the columns expanded from the * column, and the
expressions referenced in the query.
DRILL-931 introduces the concept of prefix table columns for join query when it
references * column. Turns out that for a single table having * column, we
also have to add the prefix for columns expanded from * column, so that the
execution time would be able to differentiate them.
Per discussion with Aman/Hsuan, the main idea of the fix is as follows:
1. Add prefix to table columns, when the query references at least one *
column, plus other regular column / expressions. The prefix would be removed
right before the results are outputted to SCREEN operator.
2. Star column will not subsume a regular column.
3. Regular column reference will not be prefixed; so that it would be able to
distinguished from prefixed column from star column expansion. We have to keep
those regular columns, since the parent operator might have reference to them.
4. Star column will subsume another star column, if it comes from the same
table with same prefix.
[~amansinha100], could you please review the patch?
> when 'select *' is used along with an order by on length of a column, Drill
> is adding the computed length to the list of columns
> --------------------------------------------------------------------------------------------------------------------------------
>
> Key: DRILL-1889
> URL: https://issues.apache.org/jira/browse/DRILL-1889
> Project: Apache Drill
> Issue Type: Bug
> Components: Query Planning & Optimization
> Reporter: Rahul Challapalli
> Assignee: Jinfeng Ni
> Priority: Critical
> Fix For: 0.9.0
>
>
> git.commit.id.abbrev=9dfa4a1
> Dataset :
> {code}
> {
> "col1":1,
> "col2":"a"
> }
> {
> "col1":2,
> "col2":"b"
> }
> {
> "col1":2,
> "col2":"abc"
> }
> {code}
> Query :
> {code}
> select * from `b.json` order by length(col2);
> +------------+------------+------------+
> | col1 | col2 | EXPR$1 |
> +------------+------------+------------+
> | 1 | a | 1 |
> | 2 | b | 1 |
> | 2 | abc | 3 |
> +------------+------------+------------+
> {code}
> Drill adds the length column. (EXPR$1) Not sure if this is intended behavior
> since postgres does not do this
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)