You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/01/02 14:24:22 UTC

[GitHub] [arrow-rs] alamb commented on a change in pull request #1123: Add gt_dyn_utf8_scalar kernel and tests

alamb commented on a change in pull request #1123:
URL: https://github.com/apache/arrow-rs/pull/1123#discussion_r777216807



##########
File path: arrow/src/compute/kernels/comparison.rs
##########
@@ -1393,6 +1393,29 @@ pub fn lt_eq_dyn_utf8_scalar(left: Arc<dyn Array>, right: &str) -> Result<Boolea
     result
 }
 
+/// Perform `left > right` operation on an array and a numeric scalar
+/// value. Supports StringArrays, and DictionaryArrays that have string values
+pub fn gt_dyn_utf8_scalar(left: Arc<dyn Array>, right: &str) -> Result<BooleanArray> {
+    let result = match left.data_type() {
+        DataType::Dictionary(key_type, value_type) => match value_type.as_ref() {
+            DataType::Utf8 | DataType::LargeUtf8 => {
+                dyn_compare_utf8_scalar!(&left, right, key_type, gt_utf8_scalar)
+            }
+            _ => Err(ArrowError::ComputeError(
+                "gt_dyn_utf8_scalar only supports Utf8 or LargeUtf8 arrays or DictionaryArray with Utf8 or LargeUtf8 values".to_string(),
+            )),
+        },
+        DataType::Utf8 | DataType::LargeUtf8 => {

Review comment:
       I believe this is also a problem as `LargeUtf8` is not `StringArray` but is `LargeStringArray` -- I will fix this in a subsequent PR




-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org