tustvold commented on code in PR #2591:
URL: https://github.com/apache/arrow-rs/pull/2591#discussion_r955880350
##########
arrow/src/compute/kernels/comparison.rs:
##########
@@ -315,6 +320,42 @@ pub fn like_utf8_scalar<OffsetSize: OffsetSizeTrait>(
Ok(BooleanArray::from(data))
}
+/// Perform SQL `left LIKE right` operation on [`StringArray`] /
+/// [`LargeStringArray`] and a scalar.
+///
+/// See the documentation on [`like_utf8`] for more details.
+pub fn like_utf8_scalar<OffsetSize: OffsetSizeTrait>(
+ left: &GenericStringArray<OffsetSize>,
+ right: &str,
+) -> Result<BooleanArray> {
+ like_scalar(left, right)
+}
+
+/// Perform SQL `left LIKE right` operation on [`DictionaryArray`] with values
+/// [`StringArray`]/[`LargeStringArray`] and a scalar.
+///
+/// See the documentation on [`like_utf8`] for more details.
+pub fn like_dict_scalar<K: ArrowNumericType>(
+ left: &DictionaryArray<K>,
+ right: &str,
+) -> Result<BooleanArray> {
+ match left.value_type() {
+ DataType::Utf8 => {
+ let left =
left.downcast_dict::<GenericStringArray<i32>>().unwrap();
+ like_scalar(left, right)
Review Comment:
I was actually looking at the implementation of the other dictionary
comparison kernels and they opt to instead evaluate the predicate against the
dictionary, and then call `unpack_dict_comparison` to translate this to the
values as a whole. Might be something to explore, I could see it being very
beneficial for DictionaryArray with lots of repeated values
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]