alamb commented on code in PR #4154:
URL: https://github.com/apache/arrow-datafusion/pull/4154#discussion_r1018430197


##########
datafusion/core/tests/user_defined_plan.rs:
##########
@@ -551,11 +552,7 @@ fn accumulate_batch(
         .downcast_ref::<StringArray>()
         .expect("Column 0 is not customer_id");
 
-    let revenue = input_batch
-        .column(1)
-        .as_any()
-        .downcast_ref::<Int64Array>()
-        .expect("Column 1 is not revenue");
+    let revenue = as_int64_array(input_batch.column(1)).unwrap();

Review Comment:
   Yeah I agree with @viirya that keeping specific messages in `expect(..)` is 
preferred to `unwrap()` but given this is test code that shouldn't be erroring 
anyways I think it is fine for this PR



##########
datafusion/core/src/datasource/file_format/json.rs:
##########
@@ -228,11 +228,7 @@ mod tests {
         assert_eq!(1, batches[0].num_columns());
         assert_eq!(12, batches[0].num_rows());
 
-        let array = batches[0]
-            .column(0)
-            .as_any()
-            .downcast_ref::<Int64Array>()
-            .unwrap();
+        let array = as_int64_array(batches[0].column(0))?;

Review Comment:
   this is so much nicer



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