feat(starrocks): stop eliminating semi/anti joins, QUALIFY, and FULL OUTER JOIN [CLAUDE]#7524
Merged
georgesittas merged 3 commits intotobymao:mainfrom Apr 20, 2026
Conversation
…ERATE_DATE_ARRAY [CLAUDE] StarRocks supports LEFT SEMI JOIN and LEFT ANTI JOIN natively, so remove ANTI and SEMI from TABLE_ALIAS_TOKENS (MySQL added them back since it lacks semi/anti join syntax). Add Select preprocessors to eliminate DISTINCT ON (not supported) and rewrite UNNEST(GENERATE_DATE_ARRAY(...)) to recursive CTEs (StarRocks only supports numeric inputs for array_generate/generate_series). Made-with: Cursor
georgesittas
approved these changes
Apr 20, 2026
Collaborator
georgesittas
left a comment
There was a problem hiding this comment.
Thank you for the contribution! LGTM. A couple of small suggestions related to styling.
Contributor
Author
|
Hi @georgesittas, thank you for the quick turnaround on this. Do you know when there'll be a release with this commit? The anti join rewrite would fix an active starrocks bug for us: StarRocks/starrocks#67860 |
Collaborator
|
There is no fixed cadence for releases, but we tend to do it frequently. I expect to do it some time during this week. |
Collaborator
|
@dwoldemariam-klav just released v30.5.0. |
|
Hey @georgesittas, any chance that we can also get this change as a patch release on |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
StarRocks inherits from the MySQL dialect, but it natively supports several SQL features that MySQL does not. The MySQL generator unnecessarily rewrites these into workarounds, producing suboptimal SQL for StarRocks. This PR corrects that.
Features now preserved (no longer eliminated):
LEFT SEMI JOINandLEFT ANTI JOINnatively (docs), so these are no longer rewritten intoEXISTS/NOT EXISTSsubqueries.ANTIandSEMIare also removed fromTABLE_ALIAS_TOKENSso the parser doesn't consume them as table aliases.QUALIFYfor filtering on window functions (PR #13239), so it is no longer rewritten into a subquery wrapper.FULL OUTER JOINnatively (docs), so it is no longer decomposed into aUNIONof left/right joins.Transforms carried over from the MySQL generator (features StarRocks also does not support):
ROW_NUMBER()window function pattern, since StarRocks does not supportDISTINCT ON(#33842).array_generateandgenerate_seriesonly accept numeric inputs (#49575).Made with Cursor