wjones127 commented on code in PR #8562:
URL: https://github.com/apache/arrow-datafusion/pull/8562#discussion_r1443855691


##########
datafusion/common/src/scalar.rs:
##########
@@ -942,9 +958,9 @@ impl ScalarValue {
             ScalarValue::Binary(_) => DataType::Binary,
             ScalarValue::FixedSizeBinary(sz, _) => 
DataType::FixedSizeBinary(*sz),
             ScalarValue::LargeBinary(_) => DataType::LargeBinary,
-            ScalarValue::List(arr)
-            | ScalarValue::LargeList(arr)
-            | ScalarValue::FixedSizeList(arr) => arr.data_type().to_owned(),
+            ScalarValue::List(arr) => arr.data_type().to_owned(),
+            ScalarValue::LargeList(arr) => arr.data_type().to_owned(),
+            ScalarValue::FixedSizeList(arr) => arr.data_type().to_owned(),

Review Comment:
   This seems like a unnecessary change.



##########
datafusion/common/src/scalar.rs:
##########
@@ -2433,11 +2455,14 @@ impl ScalarValue {
             ScalarValue::LargeBinary(val) => {
                 eq_array_primitive!(array, index, LargeBinaryArray, val)?
             }
-            ScalarValue::List(arr)
-            | ScalarValue::LargeList(arr)
-            | ScalarValue::FixedSizeList(arr) => {
-                let right = array.slice(index, 1);
-                arr == &right
+            ScalarValue::List(arr) => {
+                Self::eq_array_list(&(arr.to_owned() as ArrayRef), array, 
index)
+            }
+            ScalarValue::LargeList(arr) => {
+                Self::eq_array_list(&(arr.to_owned() as ArrayRef), array, 
index)
+            }
+            ScalarValue::FixedSizeList(arr) => {
+                Self::eq_array_list(&(arr.to_owned() as ArrayRef), array, 
index)

Review Comment:
   nit: this could be combined to avoid repeated code. (This is the last 
comment I'll make about this, but it applies to several more parts of your 
changeset)
   
   ```suggestion
               ScalarValue::List(arr)
               | ScalarValue::LargeList(arr)
               | ScalarValue::FixedSizeList(arr) => {
                   Self::eq_array_list(&(arr.to_owned() as ArrayRef), array, 
index)
   ```



##########
datafusion/common/src/scalar.rs:
##########
@@ -1147,9 +1163,9 @@ impl ScalarValue {
             ScalarValue::LargeBinary(v) => v.is_none(),
             // arr.len() should be 1 for a list scalar, but we don't seem to
             // enforce that anywhere, so we still check against array length.
-            ScalarValue::List(arr)
-            | ScalarValue::LargeList(arr)
-            | ScalarValue::FixedSizeList(arr) => arr.len() == arr.null_count(),
+            ScalarValue::List(arr) => arr.len() == arr.null_count(),
+            ScalarValue::LargeList(arr) => arr.len() == arr.null_count(),
+            ScalarValue::FixedSizeList(arr) => arr.len() == arr.null_count(),

Review Comment:
   Similar unnecessary change here.



##########
datafusion/common/src/scalar.rs:
##########
@@ -142,13 +143,13 @@ pub enum ScalarValue {
     /// Fixed size list scalar.
     ///
     /// The array must be a FixedSizeListArray with length 1.
-    FixedSizeList(ArrayRef),
+    FixedSizeList(Arc<FixedSizeListArray>),

Review Comment:
   I know I'm coming in a little late, but have we considered instead making 
the type `Scalar<Arc<FixedSizeListArray>>`? ([Scalar being the one in 
arrow-rs](https://docs.rs/arrow/latest/arrow/array/struct.Scalar.html)) This 
would enforce that the length is 1, which might be nice. I could also 
understand if that makes it too awkward to work with.



-- 
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]

Reply via email to