Skip to content

Conversation

@starocean999
Copy link
Contributor

@starocean999 starocean999 commented Apr 23, 2024

consider sql with user defined var @t_zone

set @t_zone='GMT';
SELECT 
    DATE_FORMAT(convert_tz(dt, time_zone, @t_zone),'%Y-%m-%d') day
FROM 
    t
GROUP BY 
    1;

@t_zone must be replaced as 'GMT' before EliminateGroupByConstant and NormalizeAggregate rule. So this pr move ReplaceVariableByLiteral rule from rewrite phase to analyze phase and put it before the two rules to make it work.

Issue Number: close #xxx

Further comments

If this is a relatively large or complex change, kick off the discussion at dev@doris.apache.org by explaining why you chose the solution you did and what alternatives you considered, etc...

@doris-robot
Copy link

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR

Since 2024-03-18, the Document has been moved to doris-website.
See Doris Document.

@starocean999
Copy link
Contributor Author

run buildall

new NormalizeRepeat()
),
bottomUp(new AdjustAggregateNullableForEmptySet()),
topDown(new VariableToLiteral()),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add comment to explain why must replace here

@starocean999
Copy link
Contributor Author

run buildall

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Apr 25, 2024
@github-actions
Copy link
Contributor

PR approved by at least one committer and no changes requested.

@github-actions
Copy link
Contributor

PR approved by anyone and no changes requested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by one committer. reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants