alamb commented on code in PR #8378:
URL: https://github.com/apache/arrow-datafusion/pull/8378#discussion_r1413069975
##########
datafusion/common/src/scalar.rs:
##########
@@ -50,9 +50,52 @@ use arrow::{
use arrow_array::cast::as_list_array;
use arrow_array::{ArrowNativeTypeOp, Scalar};
-/// Represents a dynamically typed, nullable single value.
-/// This is the single-valued counter-part to arrow's [`Array`].
+/// A dynamically typed, nullable single value, (the single-valued counter-part
+/// to arrow's [`Array`])
///
+/// # Performance
+///
+/// In general, please use arrow [`Array`]s rather than [`ScalarValue`]
whenever
+/// possible, as it is far more efficient for multiple values.
+///
+/// # Example
+/// ```
+/// # use datafusion_common::ScalarValue;
+/// // Create single scalar value for an Int32 value
+/// let s1 = ScalarValue::Int32(Some(10));
+///
+/// // You can also create values using the From impl:
+/// let s2 = ScalarValue::from(10i32);
+/// assert_eq!(s1, s2);
+/// ```
+///
+/// # Null Handling
+///
+/// `ScalarValue` represents null values in the same way as Arrow. Nulls are
Review Comment:
FYI @jayzhan211 -- perhaps this can help explain some of how we can avoid
using NullArray / ScalarValue::Null in the various list array functions
--
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]