-
Notifications
You must be signed in to change notification settings - Fork 25.3k
Fix testInvalidJoinPatterns #129611
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 testInvalidJoinPatterns #129611
Conversation
Pinging @elastic/es-analytical-engine (Team:Analytics) |
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.
Yikes, thanks for flagging this!
I think the right way to fix this is to not quote if the expression is already quoted due to datemath; rather than excluding them. Wdyt? If you find this acceptable, I'll push the fix to this branch. |
@@ -3205,7 +3205,7 @@ public void testInvalidJoinPatterns() { | |||
{ | |||
var fromPatterns = randomIndexPattern(); | |||
// Generate a syntactically invalid (partial quoted) pattern. | |||
var joinPattern = randomIdentifier() + ":" + quote(randomIndexPatterns(without(CROSS_CLUSTER))); | |||
var joinPattern = randomIdentifier() + ":" + quote(randomIndexPatterns(without(CROSS_CLUSTER), without(DATE_MATH))); |
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 think the problem is that we use randomIndexPatterns
(plural!). Date math should be fine in this test - why do we specifically exclude it?
Shouldn't the fix just be to use randomIndexPattern
(singular)? That also seems to be consistent with the error message on #129598:
token recognition error at: ','"
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.
Oh, yes. This actually makes sense. I don't know why I used randomIndexPatterns()
(likely wanted to use randomIndexPattern()
) and was wondering what the issue with the nested quoting was since the original tests did actually use nested quoting. Even my code comment says "pattern" specifically. Should I push the changes?
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.
Update: sorry, actually multiple index patterns would also be fine to test - although I'm not sure this is the original intention.
The problem seems to be the double quoting, because randomIndexPatterns
has a maybeQuote
in there, but we always quote the output - potentially another time.
My comment that I don't see how this relates to date math still holds IMO, but I may not be seeing something - randomization over many cases can be funny :)
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.
Another bug that may cause an issue in the future: randomIndexPatterns()
uses maybeQuote()
. Shouldn't it be quote()
considering we now prohibit partial quoting? Or else, we'll end up generating: "a",b,c
.
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.
maybeQuote
only quotes if the patterns don't contain a single "
, so this is fine.
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.
Shouldn't the fix just be to use randomIndexPattern (singular)
Makes sense! Updated to singular and this seems to not fail after couple of thousands of iterations.
@idegtiarenko , Pawan and I dissected the error message a bit offline. I still believe it's the double quoting.
|
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.
LGTM, thanks @idegtiarenko !
# Conflicts: # muted-tests.yml
According to the report, the test was accidentally generating nested quotes such as:
due to date math expressions.
Those are not necessary in this test case and could be excluded.
Closes: #129598