Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

WangGuangxin
Copy link

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

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Dec 24, 2024
Copy link

netlify bot commented Dec 24, 2024

Deploy Preview for meta-velox ready!

Name Link
🔨 Latest commit 9c045e8
🔍 Latest deploy log https://app.netlify.com/sites/meta-velox/deploys/676ad0482fb58b0008925c92
😎 Deploy Preview https://deploy-preview-11954--meta-velox.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@WangGuangxin
Copy link
Author

@pedroerp @rui-mo @jinchengchenghh @PHILO-HE Can you please help review this?

Copy link
Collaborator

@rui-mo rui-mo left a 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);
Copy link
Collaborator

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({
Copy link
Collaborator

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);
Copy link
Collaborator

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
Copy link
Collaborator

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();
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants