From 98f98d16423000a2debe2438fad876bddeaab41b Mon Sep 17 00:00:00 2001 From: Guillaume Balaine Date: Fri, 28 Jan 2022 16:51:12 +0100 Subject: [PATCH] test fix #1, errors and debug strings --- datafusion/src/error.rs | 15 +++++++++------ datafusion/src/logical_plan/dfschema.rs | 4 ++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/datafusion/src/error.rs b/datafusion/src/error.rs index bcece30cf28b..fbad9a97d37b 100644 --- a/datafusion/src/error.rs +++ b/datafusion/src/error.rs @@ -83,10 +83,8 @@ impl From for ArrowError { fn from(e: DataFusionError) -> Self { match e { DataFusionError::ArrowError(e) => e, - DataFusionError::External(e) => { - ArrowError::External("datafusion".to_string(), e) - } - other => ArrowError::External("datafusion".to_string(), Box::new(other)), + DataFusionError::External(e) => ArrowError::External("".to_string(), e), + other => ArrowError::External("".to_string(), Box::new(other)), } } } @@ -162,7 +160,10 @@ mod test { #[test] fn datafusion_error_to_arrow() { let res = return_datafusion_error().unwrap_err(); - assert_eq!(res.to_string(), "Arrow error: Schema error: bar"); + assert_eq!( + res.to_string(), + "Arrow error: Invalid argument error: Schema error: bar" + ); } /// Model what happens when implementing SendableRecrordBatchStream: @@ -179,7 +180,9 @@ mod test { #[allow(clippy::try_err)] fn return_datafusion_error() -> crate::error::Result<()> { // Expect the '?' to work - let _bar = Err(ArrowError::OutOfSpec("bar".to_string()))?; + let _bar = Err(ArrowError::InvalidArgumentError( + "Schema error: bar".to_string(), + ))?; Ok(()) } } diff --git a/datafusion/src/logical_plan/dfschema.rs b/datafusion/src/logical_plan/dfschema.rs index aee0ca22f0c6..b89b2399e67a 100644 --- a/datafusion/src/logical_plan/dfschema.rs +++ b/datafusion/src/logical_plan/dfschema.rs @@ -535,8 +535,8 @@ mod tests { let schema = DFSchema::try_from_qualified_schema("t1", &test_schema_1())?; let arrow_schema: Schema = schema.into(); let expected = - "[Field { name: \"c0\", data_type: Boolean, nullable: true, metadata: {} }, \ - Field { name: \"c1\", data_type: Boolean, nullable: true, metadata: {} }]"; + "[Field { name: \"c0\", data_type: Boolean, is_nullable: true, metadata: {} }, \ + Field { name: \"c1\", data_type: Boolean, is_nullable: true, metadata: {} }]"; assert_eq!(expected, format!("{:?}", arrow_schema.fields)); Ok(()) }