@@ -3,49 +3,52 @@ use datafusion::arrow::error::ArrowError;
33
44#[derive(Clone, PartialEq, ::prost::Message)]
55pub struct ArrowErrorProto {
6- #[prost(oneof = "ArrowErrorInnerProto", tags = "1")]
7- pub inner: Option<ArrowErrorInnerProto>,
8- #[prost(string, optional, tag = "2")]
6+ #[prost(string, optional, tag = "1")]
97 pub ctx: Option<String>,
8+ #[prost(
9+ oneof = "ArrowErrorInnerProto",
10+ tags = "2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19"
11+ )]
12+ pub inner: Option<ArrowErrorInnerProto>,
1013}
1114
1215#[derive(Clone, PartialEq, prost::Oneof)]
1316pub enum ArrowErrorInnerProto {
14- #[prost(string, tag = "1")]
15- NotYetImplemented(String),
1617 #[prost(string, tag = "2")]
17- ExternalError (String),
18+ NotYetImplemented (String),
1819 #[prost(string, tag = "3")]
19- CastError (String),
20+ ExternalError (String),
2021 #[prost(string, tag = "4")]
21- MemoryError (String),
22+ CastError (String),
2223 #[prost(string, tag = "5")]
23- ParseError (String),
24+ MemoryError (String),
2425 #[prost(string, tag = "6")]
25- SchemaError (String),
26+ ParseError (String),
2627 #[prost(string, tag = "7")]
28+ SchemaError(String),
29+ #[prost(string, tag = "8")]
2730 ComputeError(String),
28- #[prost(bool, tag = "8 ")]
31+ #[prost(bool, tag = "9 ")]
2932 DivideByZero(bool),
30- #[prost(string, tag = "9")]
31- ArithmeticOverflow(String),
3233 #[prost(string, tag = "10")]
33- CsvError (String),
34+ ArithmeticOverflow (String),
3435 #[prost(string, tag = "11")]
36+ CsvError(String),
37+ #[prost(string, tag = "12")]
3538 JsonError(String),
36- #[prost(message, tag = "12")]
37- IoError(IoErrorProto),
3839 #[prost(message, tag = "13")]
39- IpcError(String ),
40+ IoError(IoErrorProto ),
4041 #[prost(message, tag = "14")]
41- InvalidArgumentError (String),
42+ IpcError (String),
4243 #[prost(message, tag = "15")]
43- ParquetError (String),
44+ InvalidArgumentError (String),
4445 #[prost(message, tag = "16")]
46+ ParquetError(String),
47+ #[prost(message, tag = "17")]
4548 CDataInterface(String),
46- #[prost(bool, tag = "17")]
47- DictionaryKeyOverflowError(bool),
4849 #[prost(bool, tag = "18")]
50+ DictionaryKeyOverflowError(bool),
51+ #[prost(bool, tag = "19")]
4952 RunEndIndexOverflowError(bool),
5053}
5154
@@ -180,6 +183,7 @@ impl ArrowErrorProto {
180183#[cfg(test)]
181184mod tests {
182185 use super::*;
186+ use prost::Message;
183187 use std::io::{Error as IoError, ErrorKind};
184188
185189 #[test]
@@ -216,12 +220,20 @@ mod tests {
216220 &original_error,
217221 Some(&"test context".to_string()),
218222 );
223+ let proto = ArrowErrorProto::decode(proto.encode_to_vec().as_ref()).unwrap();
219224 let (recovered_error, recovered_ctx) = proto.to_arrow_error();
220225
226+ if original_error.to_string() != recovered_error.to_string() {
227+ println!("original error: {}", original_error.to_string());
228+ println!("recovered error: {}", recovered_error.to_string());
229+ }
230+
221231 assert_eq!(original_error.to_string(), recovered_error.to_string());
222232 assert_eq!(recovered_ctx, Some("test context".to_string()));
223233
224234 let proto_no_ctx = ArrowErrorProto::from_arrow_error(&original_error, None);
235+ let proto_no_ctx =
236+ ArrowErrorProto::decode(proto_no_ctx.encode_to_vec().as_ref()).unwrap();
225237 let (recovered_error_no_ctx, recovered_ctx_no_ctx) = proto_no_ctx.to_arrow_error();
226238
227239 assert_eq!(
0 commit comments