Skip to content

Commit 3057fa5

Browse files
authored
Improve error messge with detailed schema (#3637)
Signed-off-by: Veeupup <931418134@qq.com>
1 parent 3c8d8db commit 3057fa5

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

arrow-select/src/concat.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,12 @@ pub fn concat_batches<'a>(
106106
.find(|&(_, batch)| batch.schema() != *schema)
107107
{
108108
return Err(ArrowError::InvalidArgumentError(format!(
109-
"batches[{i}] schema is different with argument schema."
109+
"batches[{i}] schema is different with argument schema.
110+
batches[{i}] schema: {:?},
111+
argument schema: {:?}
112+
",
113+
batches[i].schema(),
114+
*schema
110115
)));
111116
}
112117
let field_num = schema.fields().len();
@@ -647,7 +652,7 @@ mod tests {
647652
let error = concat_batches(&schema1, [&batch1, &batch2]).unwrap_err();
648653
assert_eq!(
649654
error.to_string(),
650-
"Invalid argument error: batches[1] schema is different with argument schema.",
655+
"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_is_ordered: false, metadata: {} }, Field { name: \"b\", data_type: Utf8, nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {} }], metadata: {} }\n "
651656
);
652657
}
653658

0 commit comments

Comments
 (0)