-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
feat: Implement equality = and inequality <> support for StringView #10985
Changes from 4 commits
227fc39
9a9006c
5930faa
e36a93e
0f0de6d
6659d04
308075d
94ede95
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -932,6 +932,7 @@ fn string_coercion(lhs_type: &DataType, rhs_type: &DataType) -> Option<DataType> | |
(LargeUtf8, Utf8) => Some(LargeUtf8), | ||
(Utf8, LargeUtf8) => Some(LargeUtf8), | ||
(LargeUtf8, LargeUtf8) => Some(LargeUtf8), | ||
(Utf8View, Utf8View) => Some(Utf8View), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we handle There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree we should permit to/coercion from any "string" / "binary" type to the associated view type. It is probably good to make sure the coercion does the cheap direction when possible For example, we shouldn't be converting I think this feature -- coercion -- is probably worth its own ticket and doesn't need to be done in this PR. I'll file a follow on ticket in the morning There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I handled the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The problem with select * from t where c1 <> 'small'; Where the c1 is read to be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Filed #10996 to track Binary view support There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I wrote a bunch of tests in #10997 and the coercion mostly seems to work well. There is one exception which i think is minor and i will file a ticket about |
||
_ => None, | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
|
||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
statement ok | ||
create table test as values (arrow_cast('Andrew', 'Utf8View'), arrow_cast('X', 'Utf8View')), | ||
(arrow_cast('Xiangpeng', 'Utf8View'), arrow_cast('Xiangpeng', 'Utf8View')), | ||
(arrow_cast('Raphael', 'Utf8View'), arrow_cast('R', 'Utf8View')), | ||
(arrow_cast(NULL, 'Utf8View'), arrow_cast('R', 'Utf8View')); | ||
|
||
query B | ||
select arrow_cast('NULL', 'Utf8View') = arrow_cast('Andrew', 'Utf8View'); | ||
---- | ||
false | ||
|
||
query B | ||
select arrow_cast('NULL', 'Utf8View') <> arrow_cast('Andrew', 'Utf8View'); | ||
---- | ||
true | ||
|
||
query B | ||
select arrow_cast('Andrew', 'Utf8View') = arrow_cast('Andrew', 'Utf8View'); | ||
---- | ||
true | ||
|
||
query B | ||
select arrow_cast('Xiangpeng', 'Utf8View') <> arrow_cast('Andrew', 'Utf8View'); | ||
---- | ||
true | ||
|
||
query ?? | ||
select * from test where column1 = column2; | ||
---- | ||
Xiangpeng Xiangpeng | ||
|
||
query ?? | ||
select * from test where column1 <> column2; | ||
---- | ||
Andrew X | ||
Raphael R | ||
|
||
|
||
query ?? | ||
select * from test where column1 = arrow_cast('Andrew', 'Utf8View'); | ||
---- | ||
Andrew X | ||
|
||
query ?? | ||
select * from test where column1 <> arrow_cast('Andrew', 'Utf8View'); | ||
---- | ||
Xiangpeng Xiangpeng | ||
Raphael R |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe just
build_array_string!(StringViewArray, Utf8View)
?Can you also move this case closer to where we handle
Utf8
andLargeUtf8
?