jayzhan211 commented on code in PR #7893:
URL: https://github.com/apache/arrow-datafusion/pull/7893#discussion_r1447405114


##########
datafusion/common/src/scalar.rs:
##########
@@ -2695,14 +2730,22 @@ impl From<String> for ScalarValue {
     }
 }
 
-impl From<Vec<(&str, ScalarValue)>> for ScalarValue {
-    fn from(value: Vec<(&str, ScalarValue)>) -> Self {
-        let (fields, scalars): (SchemaBuilder, Vec<_>) = value
-            .into_iter()
-            .map(|(name, scalar)| (Field::new(name, scalar.data_type(), 
false), scalar))
-            .unzip();
+// Wrapper for ScalarValue::Struct that checks the length of the arrays, 
without nulls
+impl From<(Fields, Vec<ArrayRef>)> for ScalarValue {
+    fn from((fields, arrays): (Fields, Vec<ArrayRef>)) -> Self {
+        Self::from((fields, arrays, None))
+    }
+}
 
-        Self::Struct(Some(scalars), fields.finish().fields)
+// Wrapper for ScalarValue::Struct that checks the length of the arrays
+impl From<(Fields, Vec<ArrayRef>, Option<NullBuffer>)> for ScalarValue {

Review Comment:
   We dont need this after changing Struct with Scalar<T>



##########
datafusion/common/src/scalar.rs:
##########
@@ -2695,14 +2730,22 @@ impl From<String> for ScalarValue {
     }
 }
 
-impl From<Vec<(&str, ScalarValue)>> for ScalarValue {
-    fn from(value: Vec<(&str, ScalarValue)>) -> Self {
-        let (fields, scalars): (SchemaBuilder, Vec<_>) = value
-            .into_iter()
-            .map(|(name, scalar)| (Field::new(name, scalar.data_type(), 
false), scalar))
-            .unzip();
+// Wrapper for ScalarValue::Struct that checks the length of the arrays, 
without nulls
+impl From<(Fields, Vec<ArrayRef>)> for ScalarValue {
+    fn from((fields, arrays): (Fields, Vec<ArrayRef>)) -> Self {
+        Self::from((fields, arrays, None))
+    }
+}
 
-        Self::Struct(Some(scalars), fields.finish().fields)
+// Wrapper for ScalarValue::Struct that checks the length of the arrays
+impl From<(Fields, Vec<ArrayRef>, Option<NullBuffer>)> for ScalarValue {

Review Comment:
   We dont need this after changing Struct with `Scalar<T>`



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