Skip to content

Conversation

nik9000
Copy link
Member

@nik9000 nik9000 commented Jan 10, 2025

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.
@nik9000 nik9000 added >test Issues or PRs that are addressing/adding tests :Analytics/ES|QL AKA ESQL v9.0.0 v8.18.0 labels Jan 10, 2025
Copy link
Contributor

Documentation preview:

@elasticsearchmachine elasticsearchmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Jan 10, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-analytical-engine (Team:Analytics)

Copy link
Member

@not-napoleon not-napoleon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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<>();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could use a comment about what exactly it's adding cases for.

Copy link
Contributor

@ivancea ivancea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there other non-representable cases we want to avoid here?

Suggested change
default -> true;
default -> dt.isRepresentable();

}

return isString(order, sourceText(), SECOND);
return isNotNull(order, sourceText(), SECOND).and(isString(order, sourceText(), SECOND));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
Copy link
Member Author

@nik9000 nik9000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've reverted the troublesome changes - MvPercentile and MvSort. Those we'll grab in another PR.

@nik9000 nik9000 enabled auto-merge (squash) January 16, 2025 19:25
@nik9000 nik9000 merged commit 1c13465 into elastic:main Jan 16, 2025
16 checks passed
nik9000 added a commit to nik9000/elasticsearch that referenced this pull request Jan 16, 2025
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.
@nik9000
Copy link
Member Author

nik9000 commented Jan 16, 2025

Backport: #120324

elasticsearchmachine pushed a commit that referenced this pull request Jan 16, 2025
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.
rjernst pushed a commit to rjernst/elasticsearch that referenced this pull request Jan 16, 2025
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.
GalLalouche added a commit that referenced this pull request Jan 27, 2025
Following in the same vein as #119678 and #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
GalLalouche added a commit to GalLalouche/elasticsearch that referenced this pull request Jan 27, 2025
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
GalLalouche added a commit to GalLalouche/elasticsearch that referenced this pull request Jan 28, 2025
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
GalLalouche added a commit to GalLalouche/elasticsearch that referenced this pull request Jan 28, 2025
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
elasticsearchmachine pushed a commit that referenced this pull request Jan 28, 2025
Following in the same vein as #119678 and #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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Analytics/ES|QL AKA ESQL Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) >test Issues or PRs that are addressing/adding tests v8.18.0 v9.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants