Skip to content

[BUG] Queries with a LIMIT clause and those without it return different results. #3121

Closed

Description

@penghuo

What is the bug?
Queries with a LIMIT clause and those without it return different results.

How can one reproduce the bug?

###
POST {{baseUrl}}/_plugins/_sql/_explain
Content-Type: application/x-ndjson

{
  "query": "SELECT Origin, Dest FROM (SELECT * FROM opensearch_dashboards_sample_data_flights WHERE AvgTicketPrice > 100 GROUP BY Origin, Dest, AvgTicketPrice) AS flights WHERE AvgTicketPrice < 1000 ORDER BY AvgTicketPrice"
}

## Return 20 rows

###
POST {{baseUrl}}/_plugins/_sql/_explain
Content-Type: application/x-ndjson

{
  "query": "SELECT Origin, Dest FROM (SELECT * FROM opensearch_dashboards_sample_data_flights WHERE AvgTicketPrice > 100 GROUP BY Origin, Dest, AvgTicketPrice) AS flights WHERE AvgTicketPrice < 1000 ORDER BY AvgTicketPrice LIMIT 30"
}

### Return 19 rows, missing row is
[
  "Abu Dhabi International Airport",
  "Albuquerque International Sunport Airport"
]

What is your host/environment?

  • OS 2.17

Activity

  1. added
    bug
    and removed on Oct 25, 2024
  2. assigned and unassigned on Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugdata-correctness

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions