This is an automated email from the ASF dual-hosted git repository.

agrove pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git


The following commit(s) were added to refs/heads/master by this push:
     new 31381bfd9 impl Debug for ColumnarValue, add some docs (#3076)
31381bfd9 is described below

commit 31381bfd96f5a22db27cb28a429d570b509c0542
Author: Andrew Lamb <[email protected]>
AuthorDate: Tue Aug 9 08:23:31 2022 -0400

    impl Debug for ColumnarValue, add some docs (#3076)
---
 datafusion/expr/src/columnar_value.rs | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/datafusion/expr/src/columnar_value.rs 
b/datafusion/expr/src/columnar_value.rs
index 4867c0e74..48a29208b 100644
--- a/datafusion/expr/src/columnar_value.rs
+++ b/datafusion/expr/src/columnar_value.rs
@@ -24,8 +24,13 @@ use arrow::record_batch::RecordBatch;
 use datafusion_common::ScalarValue;
 use std::sync::Arc;
 
-/// Represents the result from an expression
-#[derive(Clone)]
+/// Represents the result of evaluating an expression: either a single
+/// `ScalarValue` or an [`ArrayRef`].
+///
+/// While a [`ColumnarValue`] can always be converted into an array
+/// for convenience, it is often much more performant to provide an
+/// optimized path for scalar values.
+#[derive(Clone, Debug)]
 pub enum ColumnarValue {
     /// Array of values
     Array(ArrayRef),
@@ -41,7 +46,8 @@ impl ColumnarValue {
         }
     }
 
-    /// Convert a columnar value into an ArrayRef
+    /// Convert a columnar value into an ArrayRef. [`Self::Scalar`] is
+    /// converted by repeating the same scalar multiple times.
     pub fn into_array(self, num_rows: usize) -> ArrayRef {
         match self {
             ColumnarValue::Array(array) => array,

Reply via email to