jayzhan211 commented on code in PR #7969:
URL: https://github.com/apache/arrow-datafusion/pull/7969#discussion_r1375572207
##########
datafusion/common/src/scalar.rs:
##########
@@ -1699,22 +1702,24 @@ impl ScalarValue {
for scalar in scalars {
if let ScalarValue::List(arr) = scalar {
- // i.e. NullArray(1)
- if arr.as_any().downcast_ref::<NullArray>().is_some() {
+ // `ScalarValue::List` contains a single element `ListArray`.
+ let list_arr = as_list_array(&arr);
+
+ if list_arr.is_null(0) {
// Repeat previous offset index
offsets.push(0);
// Element is null
valid.append(false);
- } else {
- let list_arr = as_list_array(&arr);
- let arr = list_arr.values().to_owned();
- offsets.push(arr.len());
- elements.push(arr);
-
- // Element is valid
- valid.append(true);
+ continue;
Review Comment:
I think if-else statement here is more readable.
--
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]