Skip to content

[BUG] Head command doesn't take effect #5114

@qianheng-aws

Description

@qianheng-aws

What is the bug?
PPL query:

source=employees | eval a = rand() | sort a | fields id | head 5

returns rows more than 5.

How can one reproduce the bug?
Steps to reproduce the behavior:

  1. Put documents more than the head limiation
POST localhost:9200/{{index}}/_bulk
{"index":{"_id":"1"}}
{"id":1,"name":"Dev","reportsTo":"Eliot"}
{"index":{"_id":"2"}}
{"id":2,"name":"Eliot","reportsTo":"Ron"}
{"index":{"_id":"3"}}
{"id":3,"name":"Ron","reportsTo":"Andrew"}
{"index":{"_id":"4"}}
{"id":4,"name":"Andrew","reportsTo":null}
{"index":{"_id":"5"}}
{"id":5,"name":"Asya","reportsTo":"Ron"}
{"index":{"_id":"6"}}
{"id":6,"name":"Dan","reportsTo":"Andrew"}
  1. Query using above query
source=employees | eval a = rand() | sort a | fields id | head 5

It return all 6 rows.

What is the expected behavior?
Should return 5 rows.

What is your host/environment?

  • OS: MacOs
  • Version 3.5.0-SNAPSHOT
  • Plugins

Do you have any screenshots?
If applicable, add screenshots to help explain your problem.

Do you have any additional context?
Add any other context about the problem.

Metadata

Metadata

Assignees

Labels

PPLPiped processing languagebugSomething isn't workingcalcitecalcite migration releated

Type

No type

Projects

Status

Not Started

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions