TVF Part 1/X: Support table function invocation in grammar and AST#25781
Conversation
|
Codenotify: Notifying subscribers in CODENOTIFY files for diff 17aa98c...b8ab62a.
|
| } | ||
|
|
||
| @Test | ||
| public void testTableFunctionInvocation() |
There was a problem hiding this comment.
Can you please add more complex test cases + edge cases which fail parsing?
| } | ||
|
|
||
| @Override | ||
| public boolean shallowEquals(Node o) |
There was a problem hiding this comment.
shallowEquals
Why do we need this shallowEquals function only for this use case?
There was a problem hiding this comment.
Good catch. In Trino, it is used for scope aware comparisons. Removed it as it doesn't seem like we have the same structure in Presto.
| private final Relation table; | ||
| private final Optional<List<Expression>> partitionBy; // it is allowed to partition by empty list | ||
| private final Optional<OrderBy> orderBy; | ||
| private final Optional<EmptyTableTreatment> emptyTableTreatment; |
There was a problem hiding this comment.
what is EmptyTableTreatment?
There was a problem hiding this comment.
EmptyTableTreatment holds the property that decides what to do when a table argument is empty. There are two possibilities, PRUNE or KEEP, which can be specified via PRUNE WHEN EMPTY or KEEP WHEN EMPTY.
Prune means return an empty result set when the table argument is empty. Keep means still execute the table function even though the table argument is empty.
More details can be seen in the RFC ##### Prune or keep when empty section.
dd08b78 to
2cdd814
Compare
aditi-pandit
left a comment
There was a problem hiding this comment.
@mohsaka : Changes look good to me.
Changes adapted from trino/PR#11336, 12910 Original commit: 2e00c8e64c32d6fdd813999b2e04b3b3415235c8 f0508a7ab420449c6e2960ecf1d0a8d7058242da Author: kasiafi Modifications were made to adapt to Presto including: Addition of KEEP in the parser. Adjustment of the TestSqlParser.java to apply to Presto concepts. Switch from Trino's DataType based datatypes to Presto's String based datatypes. Co-authored-by: kasiafi <30203062+kasiafi@users.noreply.github.com>
b8ab62a
2cdd814 to
b8ab62a
Compare
## Description Building on the work in #25781 and several other PRs, this PR adds documentation for table value functions (TVF) based on the Trino documentation [Table Functions](https://trino.io/docs/current/functions/table.html). ## Motivation and Context Presto features should be documented in Presto. ## Impact Documentation. ## Test Plan Local doc builds. ## Contributor checklist - [x] Please make sure your submission complies with our [contributing guide](https://github.com/prestodb/presto/blob/master/CONTRIBUTING.md), in particular [code style](https://github.com/prestodb/presto/blob/master/CONTRIBUTING.md#code-style) and [commit standards](https://github.com/prestodb/presto/blob/master/CONTRIBUTING.md#commit-standards). - [x] PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced. - [x] Documented new properties (with its default value), SQL syntax, functions, or other functionality. - [x] If release notes are required, they follow the [release notes guidelines](https://github.com/prestodb/presto/wiki/Release-Notes-Guidelines). - [x] Adequate tests were added if applicable. - [ ] CI passed. - [x] If adding new dependencies, verified they have an [OpenSSF Scorecard](https://securityscorecards.dev/#the-checks) score of 5.0 or higher (or obtained explicit TSC approval for lower scores). ## Release Notes Please follow [release notes guidelines](https://github.com/prestodb/presto/wiki/Release-Notes-Guidelines) and fill in the release notes below. ``` == RELEASE NOTES == General Changes * Add documentation for :doc:`/functions/table`. ``` ## Summary by Sourcery Documentation: - Introduce a new functions/table documentation page describing table value functions and how to use them.
## Description Building on the work in prestodb#25781 and several other PRs, this PR adds documentation for table value functions (TVF) based on the Trino documentation [Table Functions](https://trino.io/docs/current/functions/table.html). ## Motivation and Context Presto features should be documented in Presto. ## Impact Documentation. ## Test Plan Local doc builds. ## Contributor checklist - [x] Please make sure your submission complies with our [contributing guide](https://github.com/prestodb/presto/blob/master/CONTRIBUTING.md), in particular [code style](https://github.com/prestodb/presto/blob/master/CONTRIBUTING.md#code-style) and [commit standards](https://github.com/prestodb/presto/blob/master/CONTRIBUTING.md#commit-standards). - [x] PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced. - [x] Documented new properties (with its default value), SQL syntax, functions, or other functionality. - [x] If release notes are required, they follow the [release notes guidelines](https://github.com/prestodb/presto/wiki/Release-Notes-Guidelines). - [x] Adequate tests were added if applicable. - [ ] CI passed. - [x] If adding new dependencies, verified they have an [OpenSSF Scorecard](https://securityscorecards.dev/#the-checks) score of 5.0 or higher (or obtained explicit TSC approval for lower scores). ## Release Notes Please follow [release notes guidelines](https://github.com/prestodb/presto/wiki/Release-Notes-Guidelines) and fill in the release notes below. ``` == RELEASE NOTES == General Changes * Add documentation for :doc:`/functions/table`. ``` ## Summary by Sourcery Documentation: - Introduce a new functions/table documentation page describing table value functions and how to use them.
Description
This PR is the first part of many PR's to add in the TVF implementation into Presto. It is based off the Trino implementation for compatibility. It is a split, of a split of the original entire PR which is located here:
#25032
This is a split of this split PR located here:
#25484
Modifications were made to adapt to Presto including:
Addition of KEEP in the parser.
Adjustment of the TestSqlParser.java to apply to Presto concepts. Switch from Trino's DataType based datatypes to Presto's String based datatypes.
Motivation and Context
Impact
Test Plan
Parser tests cases added in TestSqlParser and TestSqlParserErrorHandling.
Contributor checklist
If release note is NOT required, use: