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

Support Custom Comparison in Simple Function API #11136

Closed

Conversation

kevinwilfong
Copy link
Contributor

Summary:
This change extends CustomType in the Simple Function API, templating it on
providesCustomComparison, with the idea that Custom Types that provide custom
comparison operators will set this value to true when they define their CustomType
template overrides.

In Simple Functions, this allows us to wrap the value in a view, called
CustomTypeWithCustomComparisonView, which overrides the standard comparison
operators and hash function to use the operators provided by the Type. It also provides a
dereference operator to access the raw underlying value.

The only other piece to this diff is adding a VectorReader that constructs the
CustomTypeWithCustomComparisonView.

This should help address #8713
so we don't have to create special flavors of UDF just for TimestampWithTimezone.

On a side note, if we extend this so that if a Custom Type does not provide custom
comparison operators we produce a similar view without the custom comparison operators,
that would likely solve the issue with custom types and the simple function interface
entirely.

In the follow up diff, I'll clean up the TimestampWithTimezone UDFs for comparisons and
greatest/least.

Differential Revision: D63670301

kevinwilfong and others added 4 commits September 30, 2024 10:23
Summary:
This change extends CustomType in the Simple Function API, templating it on
providesCustomComparison, with the idea that Custom Types that provide custom
comparison operators will set this value to true when they define their CustomType
template overrides.

In Simple Functions, this allows us to wrap the value in a view, called
CustomTypeWithCustomComparisonView, which overrides the standard comparison
operators and hash function to use the operators provided by the Type.  It also provides a
dereference operator to access the raw underlying value.

The only other piece to this diff is adding a VectorReader that constructs the
CustomTypeWithCustomComparisonView.

This should help address facebookincubator#8713
so we don't have to create special flavors of UDF just for TimestampWithTimezone.

On a side note, if we extend this so that if a Custom Type does not provide custom
comparison operators we produce a similar view without the custom comparison operators,
that would likely solve the issue with custom types and the simple function interface
entirely.

In the follow up diff, I'll clean up the TimestampWithTimezone UDFs for comparisons and
greatest/least.

Differential Revision: D63670301
@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 Oct 1, 2024
Copy link

netlify bot commented Oct 1, 2024

Deploy Preview for meta-velox canceled.

Name Link
🔨 Latest commit 9109702
🔍 Latest deploy log https://app.netlify.com/sites/meta-velox/deploys/66fb412fc640ca0007f12c7d

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D63670301

kevinwilfong pushed a commit to kevinwilfong/velox that referenced this pull request Oct 1, 2024
Summary:
With the changes to the Simple Function API introduced in
facebookincubator#11136 we no longer need to register
separate UDFs for TimestampWithTimezone to avoid collisions with int64_t at
function resolution time.  We also don't need to specialize the comparison logic.

Cleaning up the existing special cases in the comparison and greatest/least UDFs.

Differential Revision: D63704263
kevinwilfong pushed a commit to kevinwilfong/velox that referenced this pull request Oct 1, 2024
facebookincubator#11139)

Summary:
Pull Request resolved: facebookincubator#11139

With the changes to the Simple Function API introduced in
facebookincubator#11136 we no longer need to register
separate UDFs for TimestampWithTimezone to avoid collisions with int64_t at
function resolution time.  We also don't need to specialize the comparison logic.

Cleaning up the existing special cases in the comparison and greatest/least UDFs.

Differential Revision: D63704263
kevinwilfong pushed a commit to kevinwilfong/velox that referenced this pull request Oct 1, 2024
Summary:
With facebookincubator#11136 array_min and array_max
just work with TimestampWithTimezone.

Adding unit tests to verify this and ensure it doesn't break in the future.

Differential Revision: D63708110
kevinwilfong pushed a commit to kevinwilfong/velox that referenced this pull request Oct 1, 2024
Summary:
With facebookincubator#11136 array_sort just works with
TimestampWithTimezone.

Adding unit tests to verify this and ensure it doesn't break in the future.

Differential Revision: D63711984
kevinwilfong pushed a commit to kevinwilfong/velox that referenced this pull request Oct 1, 2024
Summary:
With facebookincubator#11136 array_sort just works with
TimestampWithTimezone.

Adding unit tests to verify this and ensure it doesn't break in the future.

Differential Revision: D63711984
kevinwilfong pushed a commit to kevinwilfong/velox that referenced this pull request Oct 1, 2024
…kincubator#11141)

Summary:
Pull Request resolved: facebookincubator#11141

With facebookincubator#11136 array_min and array_max
just work with TimestampWithTimezone.

Adding unit tests to verify this and ensure it doesn't break in the future.

Differential Revision: D63708110
kevinwilfong pushed a commit to kevinwilfong/velox that referenced this pull request Oct 1, 2024
…kincubator#11141)

Summary:
Pull Request resolved: facebookincubator#11141

With facebookincubator#11136 array_min and array_max
just work with TimestampWithTimezone.

Adding unit tests to verify this and ensure it doesn't break in the future.

Differential Revision: D63708110
kevinwilfong pushed a commit to kevinwilfong/velox that referenced this pull request Oct 1, 2024
…r#11142)

Summary:
Pull Request resolved: facebookincubator#11142

With facebookincubator#11136 array_sort just works with
TimestampWithTimezone.

Adding unit tests to verify this and ensure it doesn't break in the future.

Differential Revision: D63711984
kevinwilfong pushed a commit to kevinwilfong/velox that referenced this pull request Oct 1, 2024
…r#11142)

Summary:
Pull Request resolved: facebookincubator#11142

With facebookincubator#11136 array_sort just works with
TimestampWithTimezone.

Adding unit tests to verify this and ensure it doesn't break in the future.

Differential Revision: D63711984
Copy link
Contributor

@xiaoxmeng xiaoxmeng left a comment

Choose a reason for hiding this comment

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

@kevinwilfong thanks!

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 822c295.

facebook-github-bot pushed a commit that referenced this pull request Oct 3, 2024
#11139)

Summary:
Pull Request resolved: #11139

With the changes to the Simple Function API introduced in
#11136 we no longer need to register
separate UDFs for TimestampWithTimezone to avoid collisions with int64_t at
function resolution time.  We also don't need to specialize the comparison logic.

Cleaning up the existing special cases in the comparison and greatest/least UDFs.

Reviewed By: bikramSingh91

Differential Revision: D63704263

fbshipit-source-id: 4fb6b60d2ae6675f8b64acb58ecded93f53b65af
kevinwilfong pushed a commit to kevinwilfong/velox that referenced this pull request Oct 3, 2024
…kincubator#11141)

Summary:

With facebookincubator#11136 array_min and array_max
just work with TimestampWithTimezone.

Adding unit tests to verify this and ensure it doesn't break in the future.

Differential Revision: D63708110
kevinwilfong pushed a commit to kevinwilfong/velox that referenced this pull request Oct 3, 2024
…r#11142)

Summary:

With facebookincubator#11136 array_sort just works with
TimestampWithTimezone.

Adding unit tests to verify this and ensure it doesn't break in the future.

Reviewed By: bikramSingh91

Differential Revision: D63711984
kevinwilfong pushed a commit to kevinwilfong/velox that referenced this pull request Oct 7, 2024
…kincubator#11141)

Summary:

With facebookincubator#11136 array_min and array_max
just work with TimestampWithTimezone.

Adding unit tests to verify this and ensure it doesn't break in the future.

Differential Revision: D63708110
kevinwilfong pushed a commit to kevinwilfong/velox that referenced this pull request Oct 7, 2024
…kincubator#11141)

Summary:

With facebookincubator#11136 array_min and array_max
just work with TimestampWithTimezone.

Adding unit tests to verify this and ensure it doesn't break in the future.

Differential Revision: D63708110
kevinwilfong pushed a commit to kevinwilfong/velox that referenced this pull request Oct 7, 2024
…r#11142)

Summary:

With facebookincubator#11136 array_sort just works with
TimestampWithTimezone.

Adding unit tests to verify this and ensure it doesn't break in the future.

Reviewed By: bikramSingh91

Differential Revision: D63711984
kevinwilfong pushed a commit to kevinwilfong/velox that referenced this pull request Oct 7, 2024
…kincubator#11141)

Summary:

With facebookincubator#11136 array_min and array_max
just work with TimestampWithTimezone.

Adding unit tests to verify this and ensure it doesn't break in the future.

Differential Revision: D63708110
kevinwilfong pushed a commit to kevinwilfong/velox that referenced this pull request Oct 7, 2024
…r#11142)

Summary:

With facebookincubator#11136 array_sort just works with
TimestampWithTimezone.

Adding unit tests to verify this and ensure it doesn't break in the future.

Reviewed By: bikramSingh91

Differential Revision: D63711984
facebook-github-bot pushed a commit that referenced this pull request Oct 8, 2024
Summary:
Pull Request resolved: #11141

With #11136 array_min and array_max
just work with TimestampWithTimezone.

Adding unit tests to verify this and ensure it doesn't break in the future.

Reviewed By: kgpai

Differential Revision: D63708110

fbshipit-source-id: 4dfd162c0914a5a2ec6304f6aaedd505a3921913
facebook-github-bot pushed a commit that referenced this pull request Oct 8, 2024
Summary:
Pull Request resolved: #11142

With #11136 array_sort just works with
TimestampWithTimezone.

Adding unit tests to verify this and ensure it doesn't break in the future.

Reviewed By: bikramSingh91

Differential Revision: D63711984

fbshipit-source-id: c9e943d77c264ccc2a56dd0df8ee044e5a373d63
kevinwilfong pushed a commit to kevinwilfong/velox that referenced this pull request Oct 10, 2024
Summary:
With facebookincubator#11136 array_union and
array_remove just work with TimestampWithTimezone.

Adding unit tests to verify this and ensure it doesn't break in the future.

Differential Revision: D64196032
kevinwilfong pushed a commit to kevinwilfong/velox that referenced this pull request Oct 10, 2024
…facebookincubator#11222)

Summary:

With facebookincubator#11136 array_union and
array_remove just work with TimestampWithTimezone.

Adding unit tests to verify this and ensure it doesn't break in the future.

Differential Revision: D64196032
kevinwilfong pushed a commit to kevinwilfong/velox that referenced this pull request Oct 10, 2024
…facebookincubator#11222)

Summary:

With facebookincubator#11136 array_union and
array_remove just work with TimestampWithTimezone.

Adding unit tests to verify this and ensure it doesn't break in the future.

Differential Revision: D64196032
kevinwilfong pushed a commit to kevinwilfong/velox that referenced this pull request Oct 10, 2024
…facebookincubator#11222)

Summary:

With facebookincubator#11136 array_union and
array_remove just work with TimestampWithTimezone.

Adding unit tests to verify this and ensure it doesn't break in the future.

Differential Revision: D64196032
facebook-github-bot pushed a commit that referenced this pull request Oct 11, 2024
…#11222)

Summary:
Pull Request resolved: #11222

With #11136 array_union and
array_remove just work with TimestampWithTimezone.

Adding unit tests to verify this and ensure it doesn't break in the future.

Reviewed By: xiaoxmeng

Differential Revision: D64196032

fbshipit-source-id: fd2a98e61f674978a7f1099155d79c3261e46851
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. fb-exported Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants