Skip to content

Add support for parameters in LIMIT command #128464

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

Merged
merged 5 commits into from
May 27, 2025

Conversation

luigidellaquila
Copy link
Contributor

Adding support for positional and named parameters in LIMIT command, eg.

{
  "query":"FROM foo | LIMIT ?lmt",
  "params":[{"lmt":10}]
}

@@ -384,8 +382,18 @@ public PlanFactory visitWhereCommand(EsqlBaseParser.WhereCommandContext ctx) {
@Override
public PlanFactory visitLimitCommand(EsqlBaseParser.LimitCommandContext ctx) {
Source source = source(ctx);
int limit = stringToInt(ctx.INTEGER_LITERAL().getText());
return input -> new Limit(source, new Literal(source, limit, DataType.INTEGER), input);
Object val = expression(ctx.constant()).fold(FoldContext.small() /* TODO remove me */);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Doing this here for consistency with the previous behavior and to fail fast, but it could be moved to the verification phase

@elasticsearchmachine elasticsearchmachine added needs:triage Requires assignment of a team area label v9.1.0 labels May 26, 2025
@elasticsearchmachine elasticsearchmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label May 27, 2025
@elasticsearchmachine
Copy link
Collaborator

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

@elasticsearchmachine elasticsearchmachine removed the needs:triage Requires assignment of a team area label label May 27, 2025
@elasticsearchmachine
Copy link
Collaborator

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

@astefan astefan requested a review from fang-xing-esql May 27, 2025 07:49
Copy link
Member

@fang-xing-esql fang-xing-esql left a comment

Choose a reason for hiding this comment

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

LGTM, thank you @luigidellaquila !

@luigidellaquila luigidellaquila added auto-backport Automatically create backport pull requests when merged v8.19.0 labels May 27, 2025
@luigidellaquila luigidellaquila enabled auto-merge (squash) May 27, 2025 14:55
@luigidellaquila luigidellaquila merged commit 6d63670 into elastic:main May 27, 2025
17 of 18 checks passed
luigidellaquila added a commit to luigidellaquila/elasticsearch that referenced this pull request May 30, 2025
@luigidellaquila
Copy link
Contributor Author

Manual backport: #128655
(for some reason the automatic backport didn't trigger)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/ES|QL AKA ESQL auto-backport Automatically create backport pull requests when merged >enhancement ES|QL-ui Impacts ES|QL UI Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v8.19.0 v9.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants