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

Quanlong Huang updated IMPALA-12324:
------------------------------------
    Priority: Critical  (was: Major)

> toSql results of UnnestExpr could be ambiguous
> ----------------------------------------------
>
>                 Key: IMPALA-12324
>                 URL: https://issues.apache.org/jira/browse/IMPALA-12324
>             Project: IMPALA
>          Issue Type: Bug
>          Components: Frontend
>            Reporter: Quanlong Huang
>            Priority: Critical
>
> For queries that sort the unnest() results, their query plan might have 
> ambiguous labels on the sort by columns. E.g. the following query sorts by 
> two unnest() results using different order (asc v.s. desc):
> {code:sql}
> explain select id, unnest(arr1), unnest(arr2)
> from functional_parquet.complextypes_arrays
> order by 2, 3 desc; {code}
> In the query plan, the order by expressions are "item ASC, item DESC". It's 
> ambiguous that which one is sorted in ASC.
> {code:java}
> PLAN-ROOT SINK
> |
> 06:MERGING-EXCHANGE [UNPARTITIONED]
> |  order by: item ASC, item DESC
> |
> 05:SORT
> |  order by: item ASC, item DESC  <-- Ambiguous expressions
> |  row-size=20B cardinality=13.51K
> |
> 01:SUBPLAN
> |  row-size=44B cardinality=13.51K
> |
> |--04:NESTED LOOP JOIN [CROSS JOIN]
> |  |  row-size=44B cardinality=10
> |  |
> |  |--02:SINGULAR ROW SRC
> |  |     row-size=28B cardinality=1
> |  |
> |  03:UNNEST [functional_parquet.complextypes_arrays.arr1 arr1, 
> functional_parquet.complextypes_arrays.arr2 arr2]
> |     row-size=0B cardinality=10
> |
> 00:SCAN HDFS [functional_parquet.complextypes_arrays]
>    HDFS partitions=1/1 files=1 size=1.06KB
>    row-size=28B cardinality=1.35K
> {code}
> Another example is empty unnest() parameter in the query plan. The query is:
> {code:sql}
> explain select id, item1, item2, row_number() over (order by id, item1, item2 
> desc)
> from (
>   select id, unnest(arr1) as item1, unnest(arr2) as item2
>   from functional_parquet.complextypes_arrays
> ) v; {code}
> The plan has "order by: id ASC, UNNEST() ASC, UNNEST() DESC":
> {code:java}
> PLAN-ROOT SINK
> |
> 06:ANALYTIC
> |  functions: row_number()
> |  order by: id ASC, UNNEST() ASC, UNNEST() DESC  <-- Ambiguous expressions
> |  window: ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
> |  row-size=56B cardinality=13.51K
> |
> 07:MERGING-EXCHANGE [UNPARTITIONED]
> |  order by: id ASC, UNNEST() ASC, UNNEST() DESC
> |
> 05:SORT
> |  order by: id ASC, UNNEST() ASC, UNNEST() DESC
> |  row-size=48B cardinality=13.51K
> |
> 01:SUBPLAN
> |  row-size=44B cardinality=13.51K
> |
> |--04:NESTED LOOP JOIN [CROSS JOIN]
> |  |  row-size=44B cardinality=10
> |  |
> |  |--02:SINGULAR ROW SRC
> |  |     row-size=28B cardinality=1
> |  |
> |  03:UNNEST [functional_parquet.complextypes_arrays.arr1 arr1, 
> functional_parquet.complextypes_arrays.arr2 arr2]
> |     row-size=0B cardinality=10
> |
> 00:SCAN HDFS [functional_parquet.complextypes_arrays]
>    HDFS partitions=1/1 files=1 size=1.06KB
>    row-size=28B cardinality=1.35K {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to