-
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: Support Spark explode outer #11954
base: main
Are you sure you want to change the base?
feat: Support Spark explode outer #11954
Conversation
✅ Deploy Preview for meta-velox ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
@pedroerp @rui-mo @jinchengchenghh @PHILO-HE Can you please help review this? |
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.
Thanks.
@@ -106,6 +107,9 @@ class Unnest : public Operator { | |||
const RowRange& rowRange, | |||
std::vector<VectorPtr>& outputs); | |||
|
|||
template <bool isOuter> | |||
void countMaxNumElementsPerRow(int32_t size); |
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.
Perhaps document this function and the 'isOuter' template parameter.
// is_outer = false | ||
auto op1 = PlanBuilder().values({vector}).unnest({"c0"}, {"c1"}, std::nullopt, false /* is_outer */).planNode(); | ||
auto params1 = makeCursorParameters(op1); | ||
auto expected1 = makeRowVector({ |
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.
nit: can we have 'op', 'params', 'expected' and reuse them in the other test cases?
UnnestNode( | ||
const PlanNodeId& id, | ||
std::vector<FieldAccessTypedExprPtr> replicateVariables, | ||
std::vector<FieldAccessTypedExprPtr> unnestVariables, | ||
const std::vector<std::string>& unnestNames, | ||
const std::optional<std::string>& ordinalityName, | ||
const PlanNodePtr& source); | ||
const PlanNodePtr& source, | ||
const bool isOuter); |
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.
nit: drop const when passing by value.
|
||
createDuckDbTable({vector}); | ||
|
||
// is_outer = false |
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.
nit: isOuter
createDuckDbTable({vector}); | ||
|
||
// is_outer = false | ||
auto op1 = PlanBuilder().values({vector}).unnest({"c0"}, {"c1"}, std::nullopt, false /* is_outer */).planNode(); |
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.
ditto, perhaps use the style like below.
/*isOuter=*/false
Support the explode/posexplode with outer semantic. Unlike explode/posexplode, if the array/map is null or empty then null is produced.
Spark doc: https://spark.apache.org/docs/latest/api/python/reference/pyspark.sql/api/pyspark.sql.functions.explode_outer.html