Skip to content

Conversation

@ivancea
Copy link
Contributor

@ivancea ivancea commented Feb 18, 2025

Fixes #122588

  • Replaced Source.EMPTY.writeTo(out) to source().writeTo(out) in functions emitting warnings
    • Did the same on all aggs, as Top emits an error on type resolution. This is not a bug, as type resolution errors should only happen in the coordinator. Another option would be changing Top to not generate that error there, and make it implement instead PostAnalysisVerificationAware
  • In some cases, we don't even serialize an empty source. So I had to add a new TransportVersion to do so
    • As an special case, ToLower and ToUpper weren't serializing a source, but they don't emit warnings. As they were the only remaining functions not serializing the source, I added it there too

@ivancea ivancea added >bug Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) :Analytics/ES|QL AKA ESQL v9.1.0 labels Feb 18, 2025
@elasticsearchmachine
Copy link
Collaborator

Hi @ivancea, I've created a changelog YAML for you.

@Override
public TestCase get() {
TestCase supplied = supplier.get();
if (types.size() != supplied.getData().size()) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The for below wasn't checking the case where the TestCase data had more types than the supplier. This required fixing some cases in Top and Case

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was one of the affected functions by the "warnings but no source" problem, but it had no tests for them. So here I added them based on the function errors

@ivancea ivancea marked this pull request as ready for review February 18, 2025 14:58
@elasticsearchmachine
Copy link
Collaborator

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

/**
* Returns a list with N dataType1, followed by 1 dataType2.
*/
private static List<DataType> makeTypes(DataType dataType1, DataType dataType2, int n) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Optional:

Suggested change
private static List<DataType> makeTypes(DataType dataType1, DataType dataType2, int n) {
private static List<DataType> typesList(DataType dataType1, DataType dataType2, int n) {

Copy link
Contributor

@astefan astefan left a comment

Choose a reason for hiding this comment

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

I was expecting to see some changes in IT tests as well, meaning warning message that started having proper line:column numbers.
Do you know why the change in this PR is not "visible" in IT tests?

# Conflicts:
#	server/src/main/java/org/elasticsearch/TransportVersions.java
@ivancea
Copy link
Contributor Author

ivancea commented Feb 21, 2025

@astefan From what I saw, there are no CSV tests with warnings for those functions. I'll add some cases + capability for them to double-check.
Unless by "IT tests" you mean other tests I'm not aware of

@astefan
Copy link
Contributor

astefan commented Feb 21, 2025

I don't know exactly what we have and what don't for this particular set of functionality this PR is addressing, thus my evasiveness. I am ok with CSV IT tests. Since this involves serializations and, implicitly, type resolution on the data nodes, make sure the queries used trigger this fix properly.

@ivancea ivancea requested a review from astefan February 21, 2025 17:27
Copy link
Contributor

@astefan astefan left a comment

Choose a reason for hiding this comment

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

LGTM

# Conflicts:
#	server/src/main/java/org/elasticsearch/TransportVersions.java
@ivancea ivancea enabled auto-merge (squash) February 24, 2025 12:36
@ivancea ivancea merged commit c40c5a6 into elastic:main Feb 24, 2025
17 checks passed
@ivancea ivancea deleted the esql-source-functions-warnings-fix branch February 24, 2025 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Analytics/ES|QL AKA ESQL >bug Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ESQL: Functions not serializing their Source and emitting warnings

4 participants