jonahgao commented on code in PR #10675:
URL: https://github.com/apache/datafusion/pull/10675#discussion_r1615025038


##########
datafusion/common/src/scalar/mod.rs:
##########
@@ -3089,46 +3089,21 @@ impl TryFrom<&DataType> for ScalarValue {
                 Box::new(value_type.as_ref().try_into()?),
             ),
             // `ScalaValue::List` contains single element `ListArray`.
-            DataType::List(field) => ScalarValue::List(
-                new_null_array(
-                    &DataType::List(Arc::new(Field::new(
-                        "item",
-                        field.data_type().clone(),
-                        true,
-                    ))),
-                    1,
-                )
-                .as_list::<i32>()
-                .to_owned()
-                .into(),
-            ),
-            // 'ScalarValue::LargeList' contains single element `LargeListArray
-            DataType::LargeList(field) => ScalarValue::LargeList(
-                new_null_array(
-                    &DataType::LargeList(Arc::new(Field::new(
-                        "item",
-                        field.data_type().clone(),
-                        true,
-                    ))),
-                    1,
-                )
-                .as_list::<i64>()
-                .to_owned()
-                .into(),
-            ),
+            DataType::List(field_ref) => ScalarValue::List(Arc::new(
+                GenericListArray::new_null(field_ref.clone(), 1),
+            )),
+            // `ScalarValue::LargeList` contains single element 
`LargeListArray`.
+            DataType::LargeList(field_ref) => ScalarValue::LargeList(Arc::new(
+                GenericListArray::new_null(field_ref.clone(), 1),
+            )),
             // `ScalaValue::FixedSizeList` contains single element 
`FixedSizeList`.
-            DataType::FixedSizeList(field, _) => ScalarValue::FixedSizeList(
-                new_null_array(
-                    &DataType::FixedSizeList(
-                        Arc::new(Field::new("item", field.data_type().clone(), 
true)),
-                        1,

Review Comment:
   Here, it should be the fixed length instead of always being `1`.



-- 
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: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to