You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by tu...@apache.org on 2023/01/30 15:17:02 UTC

[arrow-rs] branch master updated: Improve error messge with detailed schema (#3637)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 3057fa5f6 Improve error messge with detailed schema (#3637)
3057fa5f6 is described below

commit 3057fa5f63516672b74a75741f1b97851fe1eafd
Author: 谭巍 <co...@tanweime.com>
AuthorDate: Mon Jan 30 23:16:56 2023 +0800

    Improve error messge with detailed schema (#3637)
    
    Signed-off-by: Veeupup <93...@qq.com>
---
 arrow-select/src/concat.rs | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/arrow-select/src/concat.rs b/arrow-select/src/concat.rs
index be6b0a063..e463c12a8 100644
--- a/arrow-select/src/concat.rs
+++ b/arrow-select/src/concat.rs
@@ -106,7 +106,12 @@ pub fn concat_batches<'a>(
         .find(|&(_, batch)| batch.schema() != *schema)
     {
         return Err(ArrowError::InvalidArgumentError(format!(
-            "batches[{i}] schema is different with argument schema."
+            "batches[{i}] schema is different with argument schema.
+            batches[{i}] schema: {:?},
+            argument schema: {:?}
+            ",
+            batches[i].schema(),
+            *schema
         )));
     }
     let field_num = schema.fields().len();
@@ -647,7 +652,7 @@ mod tests {
         let error = concat_batches(&schema1, [&batch1, &batch2]).unwrap_err();
         assert_eq!(
             error.to_string(),
-            "Invalid argument error: batches[1] schema is different with argument schema.",
+            "Invalid argument error: batches[1] schema is different with argument schema.\n            batches[1] schema: Schema { fields: [Field { name: \"c\", data_type: Int32, nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {} }, Field { name: \"d\", data_type: Utf8, nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {} }], metadata: {} },\n            argument schema: Schema { fields: [Field { name: \"a\", data_type: Int32, nullable: false, dict_id: 0, dict [...]
         );
     }