You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/11/08 21:57:52 UTC

[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #4146: improve error messages while downcasting Int32Array

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


##########
datafusion/core/tests/sql/udf.rs:
##########
@@ -113,21 +108,9 @@ async fn scalar_udf() -> Result<()> {
     assert_batches_eq!(expected, &result);
 
     let batch = &result[0];
-    let a = batch
-        .column(0)
-        .as_any()
-        .downcast_ref::<Int32Array>()
-        .expect("failed to cast a");
-    let b = batch
-        .column(1)
-        .as_any()
-        .downcast_ref::<Int32Array>()
-        .expect("failed to cast b");
-    let sum = batch
-        .column(2)
-        .as_any()
-        .downcast_ref::<Int32Array>()
-        .expect("failed to cast sum");
+    let a = as_int32_array(batch.column(0))?;

Review Comment:
   😍 



-- 
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-unsubscribe@arrow.apache.org

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