-
Notifications
You must be signed in to change notification settings - Fork 211
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 1 commit
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,60 @@ Result set:: | |
| "size": 5, | ||
| "status": 200 | ||
| } | ||
|
|
||
| Fetch Size (PPL) | ||
|
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. Mark as experimental. We can target prod at 3.7 release.
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 |
||
| ================ | ||
|
|
||
| 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 between ``1`` and ``10000``. In absence of ``fetch_size`` or a value of ``0``, it will use the system default behavior (no limit). | ||
|
|
||
| +--------------------+-------------------------------------+------------------------------------+ | ||
| | 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) | | ||
| +--------------------+-------------------------------------+------------------------------------+ | ||
| | Maximum value | No hard limit | 10,000 | | ||
| +--------------------+-------------------------------------+------------------------------------+ | ||
|
|
||
| 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 | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.