Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cast with Alias is not recognized in group by #14590

Open
xiangfu0 opened this issue Dec 4, 2024 · 0 comments
Open

Cast with Alias is not recognized in group by #14590

xiangfu0 opened this issue Dec 4, 2024 · 0 comments

Comments

@xiangfu0
Copy link
Contributor

xiangfu0 commented Dec 4, 2024

Sampe query:

SELECT 
    CAST(DATE_TRUNC('day', CAST(DATETIMECONVERT(ts, '1:MILLISECONDS:EPOCH', '1:MILLISECONDS:EPOCH', '1:MILLISECONDS') AS TIMESTAMP)) AS TIMESTAMP) AS day_epoch_ms,
    sum(met) AS "sumMet"
FROM mytable
GROUP BY 
    CAST(DATE_TRUNC('day', CAST(DATETIMECONVERT(ts, '1:MILLISECONDS:EPOCH', '1:MILLISECONDS:EPOCH', '1:MILLISECONDS') AS TIMESTAMP)) AS TIMESTAMP)
ORDER BY 
    sum(met) DESC
LIMIT 10000;

Exception:

Error: {'errorCode': 150,
 'message': 'SQLParsingError:\n'
            'org.apache.pinot.sql.parsers.SqlCompilationException: '
            "'as(cast(datetrunc('day', cast(datetimeconvert(ts, "
            "'1:MILLISECONDS:EPOCH', '1:MILLISECONDS:EPOCH', "
            "'1:MILLISECONDS'), 'TIMESTAMP')), 'TIMESTAMP'), day_epoch_ms)' should "
            'appear in GROUP BY clause.\n'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant