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


##########
datafusion/common/src/scalar.rs:
##########
@@ -763,6 +763,42 @@ impl ScalarValue {
         }
     }
 
+    // ListArray compatible version of new_primitive
+    pub fn new_primitives<T: ArrowPrimitiveType>(
+        values: Vec<Option<T::Native>>,
+        d: &DataType,
+    ) -> Result<Self> {
+        if values.is_empty() {
+            return d.try_into();
+        }
+
+        // We need to convert it to ScalarValue::Primitive (Int64(0)) instead 
of ScalarValue::List (List([PrimitiveArray<Int64> [0]]))

Review Comment:
   Nice advice. I will keep this in mind



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