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

Enable enable_dereference flag for spark_expression_fuzzer_test #7875

Closed
wants to merge 1 commit into from

Conversation

rui-mo
Copy link
Collaborator

@rui-mo rui-mo commented Dec 5, 2023

Function row_constructor was only registered in Presto functions.
In RowConstructorCallToSpecialForm::constructSpecialForm, no registration
was found from function map due to the lack of registration in Spark functions.
Error occurs when accessing an invalid iterator. To fix this issue, this PR
registers row_constructor in Spark functions.
With this fix, enable_dereference flag can be enabled for
spark_expression_fuzzer_test.
#5967

Copy link

netlify bot commented Dec 5, 2023

Deploy Preview for meta-velox canceled.

Name Link
🔨 Latest commit 20cbf35
🔍 Latest deploy log https://app.netlify.com/sites/meta-velox/deploys/65711a5279eaed00088410f6

@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 5, 2023
@rui-mo
Copy link
Collaborator Author

rui-mo commented Dec 6, 2023

@mbasmanova @kgpai Could you help review? Thank you.

Copy link
Contributor

@mbasmanova mbasmanova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rui-mo I wonder whether it would be cleaner to register kRowConstructor function in Spark.

Copy link
Contributor

@mbasmanova mbasmanova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, does Spark has something similar to kRowConstructor? Do semantics match?

@mbasmanova
Copy link
Contributor

If Spark doesn't have row_constructor, then, perhaps, we should change the Fuzzer and not expect 'row_constructor' to be present. It should be possible to test dereference expression without row_constructor function. CC: @kagamiori

  if (options_.enableDereference) {
    addToTypeToExpressionListByTicketTimes("row", "row_constructor");
    addToTypeToExpressionListByTicketTimes(kTypeParameterName, "dereference");
  }

@mbasmanova
Copy link
Contributor

What happens if you remove addToTypeToExpressionListByTicketTimes("row", "row_constructor"); from

  if (options_.enableDereference) {
    addToTypeToExpressionListByTicketTimes("row", "row_constructor");
    addToTypeToExpressionListByTicketTimes(kTypeParameterName, "dereference");
  }

?

@mbasmanova
Copy link
Contributor

CC: @kagamiori

@mbasmanova mbasmanova requested a review from kagamiori December 6, 2023 06:38
@rui-mo
Copy link
Collaborator Author

rui-mo commented Dec 6, 2023

BTW, does Spark has something similar to kRowConstructor? Do semantics match?

@mbasmanova Spark does have similar function, and their semantics match. And we are using row_constructor function in Gluten for its computing.

https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/complexTypeCreator.scala#L418-L434

I wonder whether it would be cleaner to register kRowConstructor function in Spark.

It makes sense to register it in Spark function from my view.

@mbasmanova
Copy link
Contributor

@rui-mo Thank you for clarifying. Should we than chance this PR to register row_constructor for Spark?

@rui-mo
Copy link
Collaborator Author

rui-mo commented Dec 6, 2023

@mbasmanova Thank you for the suggestion. I will make changes accordingly.

Copy link
Contributor

@kagamiori kagamiori left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you for enabling row_constructor and enable_dereference!

@facebook-github-bot
Copy link
Contributor

@kagamiori has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

return functionIterator->second.factory(kRowConstructor, {}, config);
} else {
VELOX_FAIL(
fmt::format("Function {} is not registered.", kRowConstructor));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove fmt::format

@rui-mo rui-mo force-pushed the wip_deref branch 2 times, most recently from 599ccd7 to 20cbf35 Compare December 7, 2023 01:05
@rui-mo
Copy link
Collaborator Author

rui-mo commented Dec 7, 2023

@mbasmanova @kagamiori Thanks for your review. Updated.

@facebook-github-bot
Copy link
Contributor

@kagamiori has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@kagamiori merged this pull request in 85df999.

Copy link

Conbench analyzed the 1 benchmark run on commit 85df9992.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details.

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. Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants