Skip to content

Conversation

@nik9000
Copy link
Member

@nik9000 nik9000 commented May 2, 2025

This builds the infrastructure to disable spotless and some checkstyle rules on generated imports. This works around the most frustrating part of ESQL's string template generated files - the imports. It allows unused and out of order imports. This can let us remove a lot of cumbersome, tricky, and fairly useless $if$ blocks from the templates.

This builds the infrastructure to disable spotless and some checkstyle
rules on generated imports. This works around the most frustrating part
of ESQL's string template generated files - the imports. It allows
unused and out of order imports. This can let us remove a lot of
cumbersome, tricky, and fairly useless `$if$` blocks from the templates.
@nik9000 nik9000 added >non-issue :Delivery/Build Build or test infrastructure :Analytics/ES|QL AKA ESQL v9.1.0 labels May 2, 2025
@nik9000 nik9000 requested a review from a team as a code owner May 2, 2025 16:08
@elasticsearchmachine elasticsearchmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label May 2, 2025
@elasticsearchmachine
Copy link
Collaborator

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

@elasticsearchmachine elasticsearchmachine added the Team:Delivery Meta label for Delivery team label May 2, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-delivery (Team:Delivery)

Copy link
Contributor

@breskeby breskeby 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 wonder how much value we get from checking generated code at all. ultimately not just the imports are generated but the whole file so the current toggle comment might be misleading

@nik9000
Copy link
Member Author

nik9000 commented May 2, 2025

lgtm. I wonder how much value we get from checking generated code at all. ultimately not just the imports are generated but the whole file so the current toggle comment might be misleading

We get quite a bit of value out of checking the code generated by string templates like these because we copy all of the formatting from string template. We aren't running checkstyle on the code that we make using antlr or javapoet.

Copy link
Member

@dnhatn dnhatn left a comment

Choose a reason for hiding this comment

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

💯

@nik9000 nik9000 enabled auto-merge (squash) May 2, 2025 16:48
package org.elasticsearch.compute.data;

$if(BytesRef)$
// begin generated imports
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess we could apply this simplification to quite a few other *.st files too?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah. Let's get this in an do the others.

@nik9000 nik9000 merged commit 15c461d into elastic:main May 5, 2025
16 of 17 checks passed
ywangd pushed a commit to ywangd/elasticsearch that referenced this pull request May 9, 2025
This builds the infrastructure to disable spotless and some checkstyle
rules on generated imports. This works around the most frustrating part
of ESQL's string template generated files - the imports. It allows
unused and out of order imports. This can let us remove a lot of
cumbersome, tricky, and fairly useless `$if$` blocks from the templates.
jfreden pushed a commit to jfreden/elasticsearch that referenced this pull request May 12, 2025
This builds the infrastructure to disable spotless and some checkstyle
rules on generated imports. This works around the most frustrating part
of ESQL's string template generated files - the imports. It allows
unused and out of order imports. This can let us remove a lot of
cumbersome, tricky, and fairly useless `$if$` blocks from the templates.
jan-elastic pushed a commit to jan-elastic/elasticsearch that referenced this pull request Jun 18, 2025
This builds the infrastructure to disable spotless and some checkstyle
rules on generated imports. This works around the most frustrating part
of ESQL's string template generated files - the imports. It allows
unused and out of order imports. This can let us remove a lot of
cumbersome, tricky, and fairly useless `$if$` blocks from the templates.
jan-elastic pushed a commit to jan-elastic/elasticsearch that referenced this pull request Jun 19, 2025
This builds the infrastructure to disable spotless and some checkstyle
rules on generated imports. This works around the most frustrating part
of ESQL's string template generated files - the imports. It allows
unused and out of order imports. This can let us remove a lot of
cumbersome, tricky, and fairly useless `$if$` blocks from the templates.
jan-elastic added a commit that referenced this pull request Jun 19, 2025
* ES|QL SAMPLE aggregation function (#127629)

* ES|QL SAMPLE aggregation function

* [CI] Auto commit changes from spotless

* ThreadLocalRandom -> SplittableRandom

* Update docs/changelog/127629.yaml

* fix yaml test

* Add SampleTests

* docs + example

* polish code

* mark generated imports

* comment with algorith description

* use Randomness.get()

* close properly

* type checks

* reuse hash

* regen some files

* [CI] Auto commit changes from spotless

---------

Co-authored-by: elasticsearchmachine <[email protected]>

* Fix + unmute SampleTests (#127959)

* Fix memory tracking of ES|QL sample agg (#128467)

* Fix memory tracking of ES|QL sample agg

* [CI] Auto commit changes from spotless

* polish code

---------

Co-authored-by: elasticsearchmachine <[email protected]>

* ESQL: Unclean generated imports (#127723)

This removes a ton of the tricky juggling we do for generated java files
to keep the imports in order. Instead, we just live with them being out
of order a little. It's not great, but it's so so so much easier than
the terrible juggling we had been doing.

* ESQL: Disable format checks on generated imports (#127648)

This builds the infrastructure to disable spotless and some checkstyle
rules on generated imports. This works around the most frustrating part
of ESQL's string template generated files - the imports. It allows
unused and out of order imports. This can let us remove a lot of
cumbersome, tricky, and fairly useless `$if$` blocks from the templates.

---------

Co-authored-by: elasticsearchmachine <[email protected]>
Co-authored-by: Nik Everett <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Analytics/ES|QL AKA ESQL :Delivery/Build Build or test infrastructure >non-issue Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) Team:Delivery Meta label for Delivery team v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants