Skip to content

Commit

Permalink
test fix #1, errors and debug strings
Browse files Browse the repository at this point in the history
  • Loading branch information
Igosuki committed Jan 28, 2022
1 parent ab48bb2 commit 98f98d1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
15 changes: 9 additions & 6 deletions datafusion/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,8 @@ impl From<DataFusionError> 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)),
}
}
}
Expand Down Expand Up @@ -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:
Expand All @@ -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(())
}
}
4 changes: 2 additions & 2 deletions datafusion/src/logical_plan/dfschema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
}
Expand Down

0 comments on commit 98f98d1

Please sign in to comment.