-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
sql: use separate lookahead of WITH for BUCKET_COUNT #75878
sql: use separate lookahead of WITH for BUCKET_COUNT #75878
Conversation
Fixes cockroachdb#75604 In cockroachdb#75231 we use the `WITH_LA` to resolve conflicts on the `WITH BUCKET_COUNT` clause. However, it somehow makes the random sql generator generate sqls like this: ``` IMPORT INTO FAMILY . FAMILY . CHAR ( ident , ident ) PUBLICATION DATA ( PLACEHOLDER ) WITH OPTIONS ( BUCKET_COUNT = PLACEHOLDER ); ``` which is formatted into: ``` IMPORT INTO "family"."family"."char"(ident, ident) PUBLICATION DATA ('placeholder') WITH bucket_count = 'placeholder' ``` this fails the parser for sure, since it's not a legit statement in crdb. This PR creates a new lookahead token to prevent the sql generator from generating `IMPORT` statement with `BUCKET_COUNT` in it. Release note: None
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be clear that I ran a roachprod stress to repro but I was just not lucky enough to make it fail on the same case. So I wasn't able to prove my theory with a it failed before but fixed after
verification :(
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @ajwerner and @rafiss)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for fixing this! can you add a regression test case in pkg/sql/parser/testdata
?
i.e. apply this patch
then run |
@rafiss thanks for the hint, but the issue here is the random sql generator generated unexpected sql statement. so the statement would fail anyway. I played with the test you mentioned above and it just failed with |
Ah I see, then I'm not sure this fix will change that -- the |
oh yeah, agreed... I just suspect my previous change cause it so hope this change would solve it. |
Yeah looks like unlucky timing with your PR! Since it wasn't caused by that, feel free to reassign the issue back to me. But if you would still like to keep working on it, that would be very appreciated :)
No one's worked on it for a while unfortunately. Asking in #sql-experience might be the best way. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I probably don't have enough bandwidth at the moment :( Assigning back to you for now. Thanks!
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @ajwerner)
Fixes #75604
In #75231 we use the
WITH_LA
to resolve conflicts on theWITH BUCKET_COUNT
clause. I suspect it somehow made therandom sql generator generate sqls like this:
which is formatted into:
this fails the parser for sure, since it's not a legit statement in crdb.
This PR creates a new lookahead token to prevent the sql generator
from generating
IMPORT
statement withBUCKET_COUNT
in it.Release note: None