-
Notifications
You must be signed in to change notification settings - Fork 1k
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
fix: create persistent queries fail with reserved words #3216
Conversation
Thanks for the patch @spena . Since we have a passing test case, for this exact scenario, I wonder if this is also a regression due to the recent changes to execute the modified query string (through the @agavra what do you think? |
@apurvam The test case you linked is not valid. I found out that QTT tests do not validate requests sent to the REST endpoints, which is where this issue happened. This issue was introduced by some injectors called by the |
@apurvam - it's the same category of bug. #3180 refactored the QTTs so that it never went through the code path that tested this (rendering the work done in #3037 void) and I believe #3194 may have caused this specific issue. EDIT: I might be wrong here, looks like this issue was present in 5.3.0 which is before any of the above. @spena - as part of this PR, can you make sure the QTTs go back through |
@agavra, so is it the same category of bug or not? your first statement suggests so, your edit makes that ambiguous. |
I'll look into it and figure it out. I'll also add a negative test case that is expected to fail in QTT to make sure a future refactor won't mess this up again. |
Okay we were hit with a double whammy here:
I will create a PR for these changes. |
Thanks @agavra . So then this the same class of regression as the one where we dropped the |
@apurvam brilliantly put, patently depressing. |
@@ -153,11 +153,16 @@ public String visitDereferenceExpression( | |||
final Context context) { | |||
final String baseString = process(node.getBase(), context); | |||
if (node.getBase() instanceof QualifiedNameReference) { | |||
return baseString + KsqlConstants.DOT + formatIdentifier(node.getFieldName()); | |||
return baseString + KsqlConstants.DOT | |||
+ quoteReservedWord(formatIdentifier(node.getFieldName()), context); |
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.
why are we only quoting reserved here and not elsewhere? why not just do it in formatIdentifier
?
see #3222 |
I'll close this PR as this code was integrated into #3222 |
I'm facing the same issue in a production environment (we cannot update to a beta version). Any workaround to fix this without updating? |
@kekazoh Sadly not. I tried finding workarounds when I found it, but I couldn't find any except not using reserved words in your schema. |
We finally solved it creating a stream first (renaming the reserved ones). Then we do an Insert into using aliases when selecting from the original stream. It works like a charm! |
Description
Fixes #3202
This PR adds quotes around the column identifier that uses reserved words when the identifier is brought from another stream using a CSAS/CSAT.
Testing done
SqlFormatterTest
to validate the new CSAS columns come with quotes.Reviewer checklist