[ 
https://issues.apache.org/jira/browse/IMPALA-11049?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17454730#comment-17454730
 ] 

Zoltán Borók-Nagy commented on IMPALA-11049:
--------------------------------------------

Thanks for investigating it, [~skyyws].
Rewriting 'sortInfo_' makes sense to me. Alternatively maybe we can just invoke 
analyze on the exprs of 'orderByElements_'? So we won't have INVALID types in 
SimplifyCastExprRule. And sortInfo_ will be recreated from the rewritten exprs.

Then probably we don't need to change 'SimplifyCastExprRule' too much, probably 
we'd just add a precondition:
{code:java}
Preconditions.checkState(castExpr.getType() != Type.INVALID && child.getType() 
!= Type.INVALID);
{code}

> Order by clause contains cast expr execute failed after 
> 'SimplifyCastExprRule' rewrite
> --------------------------------------------------------------------------------------
>
>                 Key: IMPALA-11049
>                 URL: https://issues.apache.org/jira/browse/IMPALA-11049
>             Project: IMPALA
>          Issue Type: Bug
>          Components: Frontend
>    Affects Versions: Impala 4.1.0
>            Reporter: Sheng Wang
>            Assignee: Sheng Wang
>            Priority: Major
>
> When add new rewrite rule 'SimplifyCastExprRule' in IMPALA-10836, this query 
> will execute failed:
> {code:java}
> explain
> SELECT month(to_timestamp(cast(d_date_sk AS string),'yyyy-MM-dd')) aa
> FROM date_dim
> GROUP BY month(to_timestamp(cast(d_date_sk AS string),'yyyy-MM-dd'))
> ORDER BY month(to_timestamp(cast(d_date_sk AS string),'yyyy-MM-dd')) LIMIT 10;
> {code}
> The exception is:
> {code:java}
> ERROR: AnalysisException: No matching function with signature: 
> to_timestamp(INT, STRING).
> {code}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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

Reply via email to