-
Notifications
You must be signed in to change notification settings - Fork 25.6k
ESQL - CSV tests for invalid ranges #125714
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
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.
LGTM. More tests always nice and adds a notice to this code.
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.
/cc @bpintea - can you please take a look at this (potentially in a follow-up)?
| */ | ||
| protected boolean areBoundariesInvalid(Object lowerValue, Object upperValue) { | ||
| /* | ||
| NB: I am reasonably sure this code is dead. It can only be reached from foldable(), and as far as I can tell |
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 this is a leftover from ql as we shouldn't represent datetimes as strings inside esql, not even in literals.
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 only reason to keep this code at all is because Range should satisfy the contract of expressions, which includes foldability. But we could also just yeet this as we just never reach here.
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.
the only reason to keep this code at all is because Range should satisfy the contract of expressions, which includes foldability.
We could just throw, like the serialisation method does. But: it'd be great if we decided on supporting range syntax in the language first (issue).
We've had an attempt to bring Range into the logical planning, but eventually settled for the current, more pragmatic approach.
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.
That issue has been open for a year and a half. As far as I know, it's not planned currently, and it isn't clear that we even want to add that syntax. In the meantime, having to work around dead code adds cognitive load and extra work. If we decide we need that syntax, and that the original logic here is important, we can always find it in the git history.
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.
having to work around dead code adds cognitive load and extra work
I agree. I was thinking that knowing to look for removed code (and where) is harder than deciding we don't want this syntax and just remove the code already.
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 also think removing this dead code is the right thing to do. I'd be happy to do so, either in this PR or in a follow up, if we're in agreement that we should.
| PushFiltersToSource can also create ranges, but that is a Physical optimizer rule. Folding happens in the | ||
| Logical optimization layer, and should be done by the time we are calling PushFiltersToSource. |
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.
Thank you for adding this comment, I think the reasoning is solid.
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 a lot @not-napoleon , more tests + very useful comments, I appreciate that a lot!
|
|
||
| // Equals OR Range | ||
| /* | ||
| NB: this loop is probably dead code. There's no syntax for ranges, so the parser never produces them. This |
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.
Nit, just in case any other changes will be added to the PR:
| NB: this loop is probably dead code. There's no syntax for ranges, so the parser never produces them. This | |
| NB: this loop is currently dead code. There's no syntax for ranges, so the parser never produces them. This |
The "dead code" note in Range.java can be spotted and updated if we bring more Range support in the language, this one might not be as visible.
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'm not really sure what you're suggesting I do about making this more visible
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.
My comment was about the possibility of us extending Range support and this comment becoming inaccurate (well, despite the "probably" disclaimer). Not terribly important, can be merged as is.
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 three of us think this is dead code. Should we just remove it?
…v-tests' into esql-range-csv-tests
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.
🙏 for the comments.
💚 Backport successful
|
Add CSV tests for invalid ranges (i.e. where the lower bound is greater than the upper bound) for several data types. It looks at first glance like there should be a bug here with Date Nanos, but I cannot trigger one, and analysis suggests the code that has the bug is in fact unreachable. I've left comments to that effect.
Add CSV tests for invalid ranges (i.e. where the lower bound is greater than the upper bound) for several data types. It looks at first glance like there should be a bug here with Date Nanos, but I cannot trigger one, and analysis suggests the code that has the bug is in fact unreachable. I've left comments to that effect.
* ESQL - CSV tests for invalid ranges (#125714) Add CSV tests for invalid ranges (i.e. where the lower bound is greater than the upper bound) for several data types. It looks at first glance like there should be a bug here with Date Nanos, but I cannot trigger one, and analysis suggests the code that has the bug is in fact unreachable. I've left comments to that effect. * add capability checks
Add CSV tests for invalid ranges (i.e. where the lower bound is greater than the upper bound) for several data types. It looks at first glance like there should be a bug here with Date Nanos, but I cannot trigger one, and analysis suggests the code that has the bug is in fact unreachable. I've left comments to that effect.