Skip to content

Distinguish null constant and non-null constant in simple function's initialize method#10638

Closed
philo-he wants to merge 4 commits intofacebookincubator:mainfrom
philo-he:fix-initialize
Closed

Distinguish null constant and non-null constant in simple function's initialize method#10638
philo-he wants to merge 4 commits intofacebookincubator:mainfrom
philo-he:fix-initialize

Conversation

@philo-he
Copy link
Copy Markdown
Contributor

@philo-he philo-he commented Aug 1, 2024

In the current simple function framework, if null constant argument is passed, initialize method will wrongly use the value 0 of NullConstant vector. In this pr, ConstantArg is proposed to represent function's input with null constant and non-null constant distinguished. If the proposed API change is acceptable, this pr will modify all simple functions' initialize method.

Fix #6569.

@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 Aug 1, 2024
@netlify
Copy link
Copy Markdown

netlify Bot commented Aug 1, 2024

Deploy Preview for meta-velox canceled.

Name Link
🔨 Latest commit 6c62e8a
🔍 Latest deploy log https://app.netlify.com/sites/meta-velox/deploys/67f377363c2bbf000814b4fe

@philo-he philo-he force-pushed the fix-initialize branch 2 times, most recently from ae3a2df to 9bd80b1 Compare August 1, 2024 05:10
@philo-he
Copy link
Copy Markdown
Contributor Author

philo-he commented Aug 1, 2024

@mbasmanova, this is just an initial proposal to fix the mentioned issue. Could you take a look?

Comment thread velox/type/SimpleFunctionApi.h Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@philo-he Thank you for working on this. Would you show an example of a how 'initialize' API would change? Also, wondering if it would make sense to use exec::optional_arg_type<T> instead of this new class.

CC: @kagamiori @bikramSingh91

Copy link
Copy Markdown
Contributor Author

@philo-he philo-he Aug 9, 2024

Choose a reason for hiding this comment

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

Would you show an example of a how 'initialize' API would change?

@mbasmanova, I just updated this pr. You can see all intialize methods are affected due to its arg type is changed.

wondering if it would make sense to use exec::optional_arg_type instead of this new class.

Yes, this existing type is enough. Have tried using it in the latest code. Could you take a high-level review firstly?

Comment thread velox/functions/lib/Re2Functions.h Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why accessor_arg_type ? Can we not use optional_arg_type ?

Copy link
Copy Markdown
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.

@philo-he Thank you for working on this. This should work % the name. I'm out next week.

Comment thread velox/functions/Macros.h Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let's rename to optional_arg_type . See velox/exec/SimpleAggregateAdapter.h

// The reader type of T used in simple UDAF interface. An instance of
// arg_type allows reading one row from the input vector. This is used for UDAFs
// that have non-default null behavior.
template <typename T>
using optional_arg_type = OptionalAccessor<T>;

@stale
Copy link
Copy Markdown

stale Bot commented Dec 18, 2024

This pull request has been automatically marked as stale because it has not had recent activity. If you'd still like this PR merged, please comment on the PR, make sure you've addressed reviewer comments, and rebase on the latest main. Thank you for your contributions!

@stale stale Bot added the stale label Dec 18, 2024
@stale stale Bot removed the stale label Dec 27, 2024
@stale
Copy link
Copy Markdown

stale Bot commented Mar 27, 2025

This pull request has been automatically marked as stale because it has not had recent activity. If you'd still like this PR merged, please comment on the PR, make sure you've addressed reviewer comments, and rebase on the latest main. Thank you for your contributions!

@stale stale Bot added the stale label Mar 27, 2025
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. stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Distinguish constant and null-constant arguments in initialize method

3 participants