[C++] Implement equality comparison between Utf8View and other string types
Describe the enhancement requested
You can currently compare a Utf8View column with another Utf8View column, and you can compare between Utf8 and LargeUtf8, but you can't compare Utf8View with either Utf8 or LargeUtf8.
PyArrow reproducer:
import itertools
import pyarrow as pa
import pyarrow.compute as pc
STRING_TYPES = {
"string": pa.string(),
"large_string": pa.large_string(),
"string_view": pa.string_view(),
}
LEFT_VALUES = ["a", "b", None, "d"]
RIGHT_VALUES = ["a", "x", "c", None]
def main():
for (left_name, left_type), (right_name, right_type) in itertools.product(
STRING_TYPES.items(), repeat=2
):
left = pa.array(LEFT_VALUES, type=left_type)
right = pa.array(RIGHT_VALUES, type=right_type)
label = f"{left_name} == {right_name}"
try:
result = pc.equal(left, right)
except Exception as e:
print(f"{label}: FAILED with {type(e).__name__}: {e}")
else:
print(f"{label}: OK -> {result.to_pylist()}")
if __name__ == "__main__":
main()
With PyArrow 26.0.0 this outputs:
string == string: OK -> [True, False, None, None]
string == large_string: OK -> [True, False, None, None]
string == string_view: FAILED with ArrowNotImplementedError: Function 'equal' has no kernel matching input types (string, string_view)
large_string == string: OK -> [True, False, None, None]
large_string == large_string: OK -> [True, False, None, None]
large_string == string_view: FAILED with ArrowNotImplementedError: Function 'equal' has no kernel matching input types (large_string, string_view)
string_view == string: FAILED with ArrowNotImplementedError: Function 'equal' has no kernel matching input types (string_view, string)
string_view == large_string: FAILED with ArrowNotImplementedError: Function 'equal' has no kernel matching input types (string_view, large_string)
string_view == string_view: OK -> [True, False, None, None]
Component(s)
C++
@adamreeve - Are you working on this? If not, happy to take it.
Hi @goel-skd, thanks for the offer. I'm not working on this but @Awesome06 now has a PR open for this. @Awesome06 can you please comment on this issue so you can be assigned?
Yes I have submitted the PR for the same
Issue resolved by pull request 55171 https://github.com/apache/arrow/pull/55171