-
Notifications
You must be signed in to change notification settings - Fork 216
Support fetch_size API for PPL #5109
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
Changes from 4 commits
6470b8e
08055cd
a0aaeeb
8c3f5f0
899ef01
a4daaea
672878e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -208,13 +208,13 @@ Explain:: | |
| } | ||
| } | ||
|
|
||
| Cursor | ||
| ====== | ||
| Cursor (SQL) | ||
| ============ | ||
|
|
||
| Description | ||
| ----------- | ||
|
|
||
| To get paginated response for a query, user needs to provide `fetch_size` parameter as part of normal query. The value of `fetch_size` should be greater than `0`. In absence of `fetch_size` or a value of `0`, it will fallback to non-paginated response. This feature is only available over `jdbc` format for now. | ||
| To get paginated response for a SQL query, user needs to provide `fetch_size` parameter as part of normal query. The value of `fetch_size` should be greater than `0`. In absence of `fetch_size` or a value of `0`, it will fallback to non-paginated response. This feature is only available over `jdbc` format for now. | ||
|
|
||
| Example | ||
| ------- | ||
|
|
@@ -266,3 +266,58 @@ Result set:: | |
| "size": 5, | ||
| "status": 200 | ||
| } | ||
|
|
||
| Fetch Size (PPL) | ||
| ================ | ||
|
|
||
| Description | ||
| ----------- | ||
|
|
||
| PPL also supports the ``fetch_size`` parameter, but with different semantics from SQL. In PPL, ``fetch_size`` limits the number of rows returned in a single, complete response. **PPL does not support cursor-based pagination** — no cursor is returned and there is no way to fetch additional pages. The value of ``fetch_size`` should be greater than ``0``. In absence of ``fetch_size`` or a value of ``0``, it will use the system default behavior (no limit). The effective upper bound is governed by the ``plugins.query.size_limit`` cluster setting (defaults to ``index.max_result_window``, which is 10000). | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Repharse.
not correct. plugins.query.size_limit is the limit.
this setting is not visible to PPL user.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rephrased. Description now introduces PPL fetch_size directly, SQL/PPL differences moved to a note section. Corrected the default behavior — now states result size is governed by |
||
|
|
||
| +--------------------+-------------------------------------+------------------------------------+ | ||
| | Aspect | SQL ``fetch_size`` | PPL ``fetch_size`` | | ||
| +====================+=====================================+====================================+ | ||
| | Purpose | Cursor-based pagination | Response size limiting | | ||
| +--------------------+-------------------------------------+------------------------------------+ | ||
| | Returns cursor? | Yes | No | | ||
| +--------------------+-------------------------------------+------------------------------------+ | ||
| | Can fetch more? | Yes (with cursor) | No (single response) | | ||
| +--------------------+-------------------------------------+------------------------------------+ | ||
|
|
||
| Example | ||
| ------- | ||
|
|
||
| PPL query:: | ||
|
|
||
| >> curl -H 'Content-Type: application/json' -X POST localhost:9200/_plugins/_ppl -d '{ | ||
| "fetch_size" : 5, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what if fetch_size larger than plugins.query.size_limit . which one should follow?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since our implementation for PPL |
||
| "query" : "source = accounts | fields firstname, lastname | where age > 20" | ||
| }' | ||
|
|
||
| Result set:: | ||
|
|
||
| { | ||
| "schema": [ | ||
| { | ||
| "name": "firstname", | ||
| "type": "text" | ||
| }, | ||
| { | ||
| "name": "lastname", | ||
| "type": "text" | ||
| } | ||
| ], | ||
| "total": 5, | ||
| "datarows": [ | ||
| ["Cherry", "Carey"], | ||
| ["Lindsey", "Hawkins"], | ||
| ["Sargent", "Powers"], | ||
| ["Campos", "Olsen"], | ||
| ["Savannah", "Kirby"] | ||
| ], | ||
| "size": 5, | ||
| "status": 200 | ||
| } | ||
|
|
||
| Note that unlike the SQL response above, there is no ``cursor`` field in the PPL response. The response is complete and final. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -62,7 +62,7 @@ For the following functionalities, the query will be forwarded to the V2 query e | |
| * ML | ||
| * Kmeans | ||
| * `show datasources` and command | ||
| * Commands with `fetch_size` parameter | ||
| * SQL commands with `fetch_size` parameter (cursor-based pagination). Note: PPL's `fetch_size` (response size limiting, no cursor) is supported in Calcite Engine. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is SQL commands? Rephrase it.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated to |
||
|
|
||
|
|
||
| ## Malformed Field Names in Object Fields | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mark as experimental. We can target prod at 3.7 release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated