[FEATURE] Expose total matched row count in PPL query response

Abierto
#5,895 0 comentarios 0 reacciones 1 asignado Ver en GitHub

Los mantenedores suelen responder en 1 día

@ahkcs ya está trabajando en esto.

Desde el 20/10/2026.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
48/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
java, sql
Área
api, backend

Línea de trabajo

Start by tracing how PPL query results and response metadata are built, then compare that path with the Query DSL response's total-hit handling. The issue does not name files or tests, so first locate the PPL response entry point and its tests. Done means the response exposes total matched rows separately from returned rows, with coverage for capped results.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

feature PPL

Is your feature request related to a problem?

A PPL query response reports only the rows it returns — the result's total and its row count are always the same. There is no way for a client to tell whether more rows matched than were returned.

This becomes a problem when a consumer caps the output. In the OpenSearch MCP server, PPLQueryTool now limits returned rows (by appending | head <size>) to avoid flooding an LLM's context window — see opensearch-mcp-server-py#327. The LLM knows the size cap it requested, but it has no signal that the underlying query matched more rows, so it cannot make an informed decision about whether to widen the request. The investigation can silently proceed on a partial view.

Query DSL does not have this gap: a _search response returns hits.total.value, which acts as a hint that the returned hits are a partial slice of a larger match. PPL has no equivalent.

What solution would you like?

Have the PPL response carry the total number of matched rows as a distinct value from the number of rows returned — for example in the response metadata or a dedicated field — so a client can detect that a result was truncated and decide whether to fetch more. This mirrors the role hits.total.value plays for Query DSL.

What alternatives have you considered?

  • Running a separate ... | stats count() query to get the total. This doubles the round-trips and cost, and the two queries can race against ongoing writes.
  • Relying on the client/LLM to always request a large enough size. This defeats the purpose of capping output and still gives no truncation signal.

Do you have any additional context?

Downstream consumer: opensearch-mcp-server-py#327 (PPLQueryTool size cap). Reviewer feedback on that PR raised that a capped PPL result gives the LLM no way to know more data exists, unlike Query DSL's total hits — which is what motivated this request.

Lenguaje dominante
Java
Estrellas
176
Forks
237
Merge medio
2 d 12 h
PR fusionados (30 d)
34

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de opensearch-project/sql

Todos los issues de opensearch-project/sql

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.