Skip to content

Commit

Permalink
Add unwrap so that test doesn't capture and check the wrong error
Browse files Browse the repository at this point in the history
  • Loading branch information
OussamaSaoudi-db committed Dec 6, 2024
1 parent a4f5dfe commit 34782e1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 16 deletions.
2 changes: 1 addition & 1 deletion kernel/src/table_changes/log_replay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ fn add_transform_expr() -> Expression {
/// of time whether to filter out add/remove actions.
/// - Constructs the remove deletion vector map from paths belonging to `remove` actions to the
/// action's corresponding [`DvInfo`]. This map will be filtered to only contain paths that
/// exists in another `add` action _within the same commit_. We store the result in `remove_dvs`.
/// exists in another `add` action _within the same commit_. We store the result in `remove_dvs`.
/// Deletion vector resolution affects whether a remove action is selected in the second
/// phase, so we must perform it ahead of time in phase 1.
/// - Ensure that reading is supported on any protocol updates.
Expand Down
24 changes: 10 additions & 14 deletions kernel/src/table_changes/log_replay/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ async fn cdf_not_enabled() {

let res: DeltaResult<Vec<_>> =
table_changes_action_iter(engine, commits, get_schema().into(), None)
.and_then(|iter| iter.try_collect());
.unwrap()
.try_collect();

assert!(matches!(res, Err(Error::ChangeDataFeedUnsupported(_))));
}
Expand Down Expand Up @@ -143,7 +144,8 @@ async fn unsupported_reader_feature() {

let res: DeltaResult<Vec<_>> =
table_changes_action_iter(engine, commits, get_schema().into(), None)
.and_then(|iter| iter.try_collect());
.unwrap()
.try_collect();

assert!(matches!(res, Err(Error::ChangeDataFeedUnsupported(_))));
}
Expand Down Expand Up @@ -173,7 +175,8 @@ async fn column_mapping_should_fail() {

let res: DeltaResult<Vec<_>> =
table_changes_action_iter(engine, commits, get_schema().into(), None)
.and_then(|iter| iter.try_collect());
.unwrap()
.try_collect();

assert!(matches!(res, Err(Error::ChangeDataFeedUnsupported(_))));
}
Expand Down Expand Up @@ -203,23 +206,15 @@ async fn incompatible_schemas_fail() {

let res: DeltaResult<Vec<_>> =
table_changes_action_iter(engine, commits, cdf_schema.into(), None)
.and_then(|iter| iter.try_collect());
.unwrap()
.try_collect();

assert!(matches!(
res,
Err(Error::ChangeDataFeedIncompatibleSchema(_, _))
));
}

// The CDF schema has fields: `id: int` and `value: string`.
// This commit has schema with fields: `id: long`, `value: string` and `year: int` (non-nullable).
let schema = StructType::new([
StructField::new("id", DataType::LONG, true),
StructField::new("value", DataType::STRING, true),
StructField::new("year", DataType::INTEGER, false),
]);
assert_incompatible_schema(schema, get_schema()).await;

// The CDF schema has fields: `id: int` and `value: string`.
// This commit has schema with fields: `id: long`, `value: string` and `year: int` (nullable).
let schema = StructType::new([
Expand Down Expand Up @@ -580,7 +575,8 @@ async fn failing_protocol() {

let res: DeltaResult<Vec<_>> =
table_changes_action_iter(engine, commits, get_schema().into(), None)
.and_then(|iter| iter.try_collect());
.unwrap()
.try_collect();

assert!(res.is_err());
}
Expand Down
2 changes: 1 addition & 1 deletion kernel/src/table_changes/scan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ impl TableChangesScan {
/// deletion vectors present in the commit. The engine data in each scan data is guaranteed
/// to belong to the same commit. Several [`TableChangesScanData`] may belong to the same commit.
#[allow(unused)]
pub(crate) fn scan_data(
fn scan_data(
&self,
engine: Arc<dyn Engine>,
) -> DeltaResult<impl Iterator<Item = DeltaResult<TableChangesScanData>>> {
Expand Down

0 comments on commit 34782e1

Please sign in to comment.