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

Allow marking an argument as constant in the simple function API #7901

Closed
wants to merge 3 commits into from

Conversation

zhli1142015
Copy link
Contributor

Fixes #7877

Copy link

netlify bot commented Dec 6, 2023

Deploy Preview for meta-velox canceled.

Name Link
🔨 Latest commit aa2e3f2
🔍 Latest deploy log https://app.netlify.com/sites/meta-velox/deploys/6582a4924bb35f00073a7355

@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 6, 2023
@zhli1142015
Copy link
Contributor Author

Hello @laithsakka and @mbasmanova , could you please help review this PR?
Thanks.

@mbasmanova
Copy link
Contributor

@laithsakka gentle ping

Copy link
Contributor

@laithsakka laithsakka left a comment

Choose a reason for hiding this comment

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

thank looks good mostly , just some questions and nits
also would it make sense to make
arg_type<Constant> works by translating it to arg_type

@@ -85,7 +85,7 @@ TEST_F(SimpleFunctionInitTest, initializationArray) {
NonDefaultWithArrayInitFunction,
Array<int32_t>,
int32_t,
Array<int32_t>>({"non_default_behavior_with_init"});
Constant<Array<int32_t>>>({"non_default_behavior_with_init"});
Copy link
Contributor

Choose a reason for hiding this comment

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

why are we changing those?
I see NonDefaultWithArrayInitFunction does handles non constant arrays

    if (second == nullptr) {
      return;
    }

question, what is the effect of marking an argument as constant in the signature.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

why are we changing those? I see NonDefaultWithArrayInitFunction does handles non constant arrays

I thought the second argument is only handled in initialize function, so it should be marked as constant argument. But, yes, it can handle non constant arrays, I revert this change.

question, what is the effect of marking an argument as constant in the signature.

Constant argument now is only checked in Fuzzer. If one argument is marked as constant, only constant inputs are generated for it by Fuzzer.
#3995 (comment)

void initialize(
const core::QueryConfig& /*config*/,
const arg_type<int32_t>* /*first*/,
const arg_type<int32_t>* second,
Copy link
Contributor

Choose a reason for hiding this comment

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

this will cause lint errors remove names of unsed variables.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated, thanks.

out_type<int64_t>& out,
const arg_type<int32_t>* first,
const arg_type<int32_t>* /*second*/,
const arg_type<Varchar>* /*third*/,
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated, thanks.

@zhli1142015
Copy link
Contributor Author

Looks test failure is not related to this change.

278: ../../velox/exec/tests/ExchangeClientTest.cpp:310: Failure
278: Expected: (counter) < (kMaxIters), actual: 18 vs 18
278: [  FAILED  ] ExchangeClientTest.sourceTimeout (18001 ms)

@laithsakka
Copy link
Contributor

@zhli1142015 I think you might have missed my comment about handling
arg_type works by translating it to arg_type

ex: if a user used call(..arg_type<Constant>, to have that work, i think now that would just not compile,
but this can be done in a follow up, i will accept this for now.

@facebook-github-bot
Copy link
Contributor

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

@zhli1142015
Copy link
Contributor Author

I think you might have missed my comment about handling arg_type works by translating it to arg_type

ex: if a user used call(..arg_type, to have that work, i think now that would just not compile, but this can be done in a follow up, i will accept this for now.

Thanks for reviewing this change and sorry for missing that comment. I want to confirm if I corrrectly understand this problem, do you mean if customers define a custom type named "constant" and use it in simplme function API, we should support it?

@facebook-github-bot
Copy link
Contributor

@laithsakka merged this pull request in 9d7d4e8.

Copy link

Conbench analyzed the 1 benchmark run on commit 9d7d4e8a.

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.

Allow marking an argument as constant in the simple function API
4 participants