ESQL: Move more test type error testing#119945
Conversation
This reduces the number of test cases in ESQL a little more ala elastic#119678. It migrates a few random tests and all of the multivalue functions: ``` 92775 -> 43760 3m45 -> 4m04 ``` This adds a few more error test cases that were missing to make sure it all lines up well. And it fixes a few error messages in a few functions. That's *likely* where the extra time goes.
|
Documentation preview: |
|
Pinging @elastic/es-analytical-engine (Team:Analytics) |
not-napoleon
left a comment
There was a problem hiding this comment.
LGTM. I left a few notes about possible follow-up work, but this is a big improvement IMHO.
| TypeResolution resolution = isType(field, dt -> switch (dt) { | ||
| case UNSIGNED_LONG, GEO_POINT, GEO_SHAPE, CARTESIAN_POINT, CARTESIAN_SHAPE -> false; | ||
| default -> true; | ||
| }, sourceText(), FIRST, "not unsigned long or geo"); |
There was a problem hiding this comment.
Probably out of scope for this PR, but I wonder if DataType should have an isSortable concept that we could use here. It's a little weird that if we add a data type that shouldn't sort here, we need to update this exclusion list. Hopefully the tests will fail, so it's not that big a deal, but might be worth thinking about down the road.
There was a problem hiding this comment.
I think that's out of scope, yeah, but it does feel useful.
| return typeErrorMessage(true, validPerPosition, signature, positionalErrorMessageSupplier); | ||
| } catch (IllegalStateException e) { | ||
| // This means all the positional args were okay, so the expected error is for nulls or from the combination | ||
| return EsqlBinaryComparison.formatIncompatibleTypesMessage(signature.get(0), signature.get(1), sourceForSignature(signature)); |
There was a problem hiding this comment.
Out of scope here, but maybe we should move formatIncompatibleTypesMessage if we're going to use it for more than just the comparison operators.
| * In general MvCount should support all signatures. While building a | ||
| * new type you may we to temporarily remove this. | ||
| */ | ||
| throw new UnsupportedOperationException("all signatures should be supported"); |
There was a problem hiding this comment.
I like this pattern for validating that all types work. Let's add a note in the javadoc for ErrorsForCasesWithoutExamplesTestCase that we want to follow this pattern for "any type" functions. If it comes up enough, might be worth refactoring it too.
| nulls(suppliers, orderType); | ||
| } | ||
|
|
||
| List<TestCaseSupplier> extra = new ArrayList<>(); |
There was a problem hiding this comment.
This could use a comment about what exactly it's adding cases for.
ivancea
left a comment
There was a problem hiding this comment.
LGTM! Some minor concerns, ignore them at will
| TypeResolution resolution = isType(field, DataType::isRepresentable, sourceText(), FIRST, "representable"); | ||
| TypeResolution resolution = isType(field, dt -> switch (dt) { | ||
| case UNSIGNED_LONG, GEO_POINT, GEO_SHAPE, CARTESIAN_POINT, CARTESIAN_SHAPE -> false; | ||
| default -> true; |
There was a problem hiding this comment.
Are there other non-representable cases we want to avoid here?
| default -> true; | |
| default -> dt.isRepresentable(); |
| } | ||
|
|
||
| return isString(order, sourceText(), SECOND); | ||
| return isNotNull(order, sourceText(), SECOND).and(isString(order, sourceText(), SECOND)); |
There was a problem hiding this comment.
This is already checked in the PostOptimizationVerificationAware interface, implemented here.
Given that most TypeResolutions consider null to be "ok", I would probably leave it as-is, and check it in the other interface?
Unless there's another reason to add this change. It really doesn't matter I think, just to avoid doing it "sometimes"
There was a problem hiding this comment.
Got it. I'll see if I can incorportate that bit.
Adds tests for requests that would fill up the heap and crash elasticsearch but for our circuit breakers. In an ideal world we'd stream these results back to and this wouldn't crash anything. But we don't have that at the moment.
nik9000
left a comment
There was a problem hiding this comment.
I've reverted the troublesome changes - MvPercentile and MvSort. Those we'll grab in another PR.
This reduces the number of test cases in ESQL a little more ala elastic#119678. It migrates a few random tests and all of the multivalue functions: ``` 92775 -> 43760 3m45 -> 4m04 ``` This adds a few more error test cases that were missing to make sure it all lines up well. And it fixes a few error messages in a few functions. That's *likely* where the extra time goes.
|
Backport: #120324 |
This reduces the number of test cases in ESQL a little more ala #119678. It migrates a few random tests and all of the multivalue functions: ``` 92775 -> 43760 3m45 -> 4m04 ``` This adds a few more error test cases that were missing to make sure it all lines up well. And it fixes a few error messages in a few functions. That's *likely* where the extra time goes.
This reduces the number of test cases in ESQL a little more ala elastic#119678. It migrates a few random tests and all of the multivalue functions: ``` 92775 -> 43760 3m45 -> 4m04 ``` This adds a few more error test cases that were missing to make sure it all lines up well. And it fixes a few error messages in a few functions. That's *likely* where the extra time goes.
Following in the same vein as elastic#119678 and elastic#119945, this PR moves the errors tests in the numeric package to their own class. 43,303 tests -> 34,521 tests 6m 30s -> 5m 50s
Following in the same vein as elastic#119678 and elastic#119945, this PR moves the errors tests in the numeric package to their own class. 43,303 tests -> 34,521 tests 6m 30s -> 5m 50s
Following in the same vein as elastic#119678 and elastic#119945, this PR moves the errors tests in the numeric package to their own class. 43,303 tests -> 34,521 tests 6m 30s -> 5m 50s
This reduces the number of test cases in ESQL a little more ala #119678. It migrates a few random tests and all of the multivalue functions:
This adds a few more error test cases that were missing to make sure it all lines up well. And it fixes a few error messages in a few functions. That's likely where the extra time goes.