-
Notifications
You must be signed in to change notification settings - Fork 139
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
[RFC] Support JOIN command in PPL #2913
Comments
|
Thanks for bring the RFC of Core on table. All items are coordination-node joins. I will update this RFC once the opensearch-project/OpenSearch#15185 could provide (or mention in milestones) an API to leverage here to support BCJ. |
@LantaoJin this looks great ! |
Join reorder maybe depend on which syntax option do we choose as well. See my latest updates (two options). |
@LantaoJin thanks for the excellent review and suggestions - IMO option 2 if more corresponding to the pipeline style of syntax and also does look familiar from other pipe based languages... |
We support INNER, OUTER LEFT, and CROSS joins in SQL so that should be our baseline in PPL as well. Option 2 it sounds like it will give us more flexibility to grow as well in the future which will be better for the community. |
Is your feature request related to a problem?
Current JOIN syntax is only available in SQL query due to the implementation of JOIN is in v1 engine only. To support JOIN command in PPL, we should implement it in v2 engine. One proposal is reusing legacy JOIN implementation in v2 engine, but the legacy JOIN implementation lacks scalability and hardly to enhance, #49 listed many requirements of enhancement.
What solution would you like?
To mitigate the impacts of customer SQL experience, an ideal process to support JOIN will be as following:
PPL Join Syntax Options: (Updated at Sep 14)
#### Option 1: Join clause as a source extension existing in Search command and should be at the beginning of PPL.search
command), it must fill at the beginning of ppl command.Here is an example:
Original SQL (TPC-H Q13 with table alias):
The rewriting PPL of Option 1:
(Winner) Option 2: Join clause as a PPL command could be existing anywhere.
In Option 2, Join sides could be tableSource:
Also, in Option 2, Join sides can be sub-search (sub-search itself unsupported yet)
|
and exist anywhere.The rewriting PPL of Option 2 for previous example:
Syntax Milestones:
1.1 Support two tables join
joinType:
INNER | LEFT [OUTER] | [LEFT] SEMI | [LEFT] ANTI
joinCriteria:
<left-table>.<field>=<right-table>.<field> [AND <left-table>.<field>=<right-table>.<field>]
or
<leftAlias>.<field>=<rightAlias>.<field> [AND <leftAlias>.<field>=<rightAlias>.<field>]
<relation>
could be sub-search, but sub-search is unsupported yet.1.2 Support multiple tables join
<relationX>
could be sub-search, but sub-search is unsupported yet.1.5 Support join hint
<relation>
could be sub-search, but sub-search is unsupported yet.1.6 Support more join types
What alternatives have you considered?
No
Do you have any additional context?
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: