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

Implement equality = and inequality <> support for BinaryView #10996

Closed
Tracked by #10918
alamb opened this issue Jun 19, 2024 · 3 comments
Closed
Tracked by #10918

Implement equality = and inequality <> support for BinaryView #10996

alamb opened this issue Jun 19, 2024 · 3 comments

Comments

@alamb
Copy link
Contributor

alamb commented Jun 19, 2024

Is your feature request related to a problem or challenge?

Part of #10918, [StringViewArray](https://docs.rs/arrow/latest/arrow/array/type.StringViewArray.html) support in DataFusion

@Weijun-H added support for <> and != forStringView in #10985. We also need similar support for BinaryView

Describe the solution you'd like

In order to improve performance of these queries we will need the ability to actually compare StringViewArrays to constant values (and likely to each other)

Thus I would like to be able to run

BinaryView = scalar
BianryView = StringViewColumn

I basically want to to run the following queries (where table foo has BinaryView columns)

> create table foo as values ('Andrew', 'X'), ('Xiangpeng', 'Xiangpeng'), ('Raphael', 'R');
0 row(s) fetched.
Elapsed 0.002 seconds.

> select * from foo where column1 = 'Andrew';
+---------+---------+
| column1 | column2 |
+---------+---------+
| Andrew  | X       |
+---------+---------+
1 row(s) fetched.
Elapsed 0.003 seconds.

> select * from foo where column1 <> 'Andrew';
+-----------+-----------+
| column1   | column2   |
+-----------+-----------+
| Xiangpeng | Xiangpeng |
| Raphael   | R         |
+-----------+-----------+
2 row(s) fetched.
Elapsed 0.001 seconds.

> select * from foo where column1 = column2;
+-----------+-----------+
| column1   | column2   |
+-----------+-----------+
| Xiangpeng | Xiangpeng |
+-----------+-----------+
1 row(s) fetched.
Elapsed 0.002 seconds.

> select * from foo where column1 <> column2;
+---------+---------+
| column1 | column2 |
+---------+---------+
| Andrew  | X       |
| Raphael | R       |
+---------+---------+
2 row(s) fetched.
Elapsed 0.001 seconds.

Describe alternatives you've considered

I suspect we will need to update the coercion logic and maybe also the arrow equality kernels like https://docs.rs/arrow/latest/arrow/compute/kernels/cmp/fn.eq.html

Additional context

No response

@PsiACE
Copy link
Member

PsiACE commented Jun 19, 2024

I want to try it.

@alamb
Copy link
Contributor Author

alamb commented Jun 19, 2024

Thanks @PsiACE !

I think you can mostly follow the model / examples of StringView.

Please remember to create a PR that targets the string-view branch (not main)

@alamb
Copy link
Contributor Author

alamb commented Jun 20, 2024

Closed in #11004

@alamb alamb closed this as completed Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants