-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
feat: Add index join conditions #12461
base: main
Are you sure you want to change the base?
Conversation
This pull request was exported from Phabricator. Differential Revision: D70233337 |
✅ Deploy Preview for meta-velox canceled.
|
@@ -1768,6 +1768,74 @@ class MergeJoinNode : public AbstractJoinNode { | |||
static PlanNodePtr create(const folly::dynamic& obj, void* context); | |||
}; | |||
|
|||
struct IndexJoinCondition; | |||
using IndexJoinConditionPtr = std::shared_ptr<IndexJoinCondition>; | |||
struct IndexJoinCondition : public ISerializable { |
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.
Just my 2 cents: Does IndexJoinCondition
have to extend ISerializable
given the subclasses are unlikely using name
JSON field as type annotations?
Summary: Change index join condition from SQL expression to a more strict condition structure to present in query plan node Differential Revision: D70233337
6383bac
to
dafb100
Compare
This pull request was exported from Phabricator. Differential Revision: D70233337 |
Summary: Change index join condition from SQL expression to a more strict condition structure to present in query plan node Differential Revision: D70233337
dafb100
to
257e44a
Compare
This pull request was exported from Phabricator. Differential Revision: D70233337 |
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.
@xiaoxmeng Meng, would you update PR description to explain what kinds of conditions are supported for index join?
velox/connectors/Connector.h
Outdated
@@ -584,8 +588,8 @@ class Connector { | |||
/// Here, | |||
/// - 'inputType' is ROW{t.sid, t.event_list} | |||
/// - 'numJoinKeys' is 1 since only t.sid is used in join equi-clauses. | |||
/// - 'joinConditions' is list of one expression: contains(t.event_list, | |||
/// u.event_type) | |||
/// - 'joinConditions' is list of one join condition: contains(t.event_list, |
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.
typo: "is list of one join condition" - why would we need a list of one?
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.
This is to describe a particular example. The join conditions is a list of conditions and in above example, there is only one condition. I rephrase a bit to make it clear.
|
||
IndexJoinCondition(FieldAccessTypedExprPtr _key) : key(std::move(_key)) {} | ||
|
||
folly::dynamic serialize() const override; |
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.
Should we leave this not implemented?
velox/core/PlanNode.h
Outdated
TypedExprPtr upper; | ||
|
||
BetweenIndexJoinCondition( | ||
FieldAccessTypedExprPtr key, |
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.
_key
velox/exec/tests/utils/PlanBuilder.h
Outdated
/// @param joinType Type of the join supported: inner, left. | ||
/// | ||
/// See hashJoin method for the description of the other parameters. | ||
PlanBuilder& indexLookupJoin( | ||
const std::vector<std::string>& leftKeys, | ||
const std::vector<std::string>& rightKeys, | ||
const core::TableScanNodePtr& right, | ||
const std::vector<std::string>& joinCondition, | ||
const std::vector<IndexJoinCondition>& joinConditions, |
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.
Can we keep this as a SQL string as it is easier to use? Let's document what SQL strings are supported.
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.
Good point.
return isConstant; | ||
} | ||
|
||
void addBetweenCondition( |
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.
Would you ad comments to explain what these functions do?
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.
Comment added.
Summary: Change index join condition from SQL expression to a more strict condition structure to present in query plan node Differential Revision: D70233337
257e44a
to
87afeb2
Compare
This pull request was exported from Phabricator. Differential Revision: D70233337 |
Summary: Pull Request resolved: facebookincubator#12461 Change index join condition from SQL expression to a more strict condition structure to present in query plan node Differential Revision: D70233337
87afeb2
to
f618f14
Compare
Summary: Change index join condition from SQL expression to a more strict condition structure to present in query plan node Differential Revision: D70233337
f618f14
to
d143565
Compare
std::move(keyColumnExpr), std::move(lowerExpr), std::move(upperExpr)); | ||
} | ||
|
||
VELOX_USER_FAIL("Invalid index join condition: {}", joinCondition); |
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.
Would you update the API comments to clarify what are supported conditions and enhance this error message to include that as well?
This pull request was exported from Phabricator. Differential Revision: D70233337 |
Summary: Pull Request resolved: facebookincubator#12461 Change index join condition from SQL expression to a more strict condition structure to present in query plan node Differential Revision: D70233337
d143565
to
72d863d
Compare
Summary: Change index join condition from SQL expression to a more strict condition structure to present in query plan node Differential Revision: D70233337
72d863d
to
7507a1d
Compare
This pull request was exported from Phabricator. Differential Revision: D70233337 |
This pull request was exported from Phabricator. Differential Revision: D70233337 |
Summary: Change index join condition from SQL expression to a more strict condition structure to present in query plan node Differential Revision: D70233337
f006e0a
to
2d00197
Compare
This pull request was exported from Phabricator. Differential Revision: D70233337 |
Summary: Change index join condition from SQL expression to a more strict condition structure to present in query plan node Reviewed By: wenqiwooo, zacw7 Differential Revision: D70233337
2d00197
to
e028762
Compare
This pull request was exported from Phabricator. Differential Revision: D70233337 |
Summary: Change index join condition from SQL expression to a more strict condition structure to present in query plan node Reviewed By: wenqiwooo, zacw7 Differential Revision: D70233337
e028762
to
3f8a705
Compare
This pull request was exported from Phabricator. Differential Revision: D70233337 |
Summary: Change index join condition from SQL expression to a more strict condition structure to present in query plan node Reviewed By: wenqiwooo, zacw7 Differential Revision: D70233337
3f8a705
to
32bab37
Compare
This pull request was exported from Phabricator. Differential Revision: D70233337 |
Summary: Pull Request resolved: facebookincubator#12461 Change index join condition from SQL expression to a more strict condition structure to present in query plan node Reviewed By: wenqiwooo, zacw7 Differential Revision: D70233337
32bab37
to
566d785
Compare
Summary: Change index join condition from SQL expression to a more strict condition structure to present in query plan node Reviewed By: wenqiwooo, zacw7 Differential Revision: D70233337
566d785
to
3d6ed3b
Compare
This pull request was exported from Phabricator. Differential Revision: D70233337 |
Summary: Change index join condition from SQL expression to a more strict condition structure to present in query plan node Reviewed By: wenqiwooo, zacw7 Differential Revision: D70233337
3d6ed3b
to
323ec58
Compare
This pull request was exported from Phabricator. Differential Revision: D70233337 |
Summary: Change index join condition from SQL expression to a more strict condition structure to present in query plan node Reviewed By: wenqiwooo, zacw7 Differential Revision: D70233337
323ec58
to
3f53873
Compare
Summary: Change index join condition from SQL expression to a more strict condition structure to present in query plan node Reviewed By: wenqiwooo, zacw7 Differential Revision: D70233337
3f53873
to
495a376
Compare
This pull request was exported from Phabricator. Differential Revision: D70233337 |
Summary: Pull Request resolved: facebookincubator#12461 Change index join condition from SQL expression to a more strict condition structure to present in query plan node Reviewed By: wenqiwooo, zacw7 Differential Revision: D70233337
This pull request was exported from Phabricator. Differential Revision: D70233337 |
495a376
to
c856260
Compare
Summary:
Change index join condition from SQL expression to a more strict condition structure
to present in query plan node
Differential Revision: D70233337