Skip to content

Commit

Permalink
chore: fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
ion-elgreco committed Nov 26, 2024
1 parent c948e81 commit f984855
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions crates/core/src/delta_datafusion/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1206,13 +1206,17 @@ impl DeltaDataChecker {
pub fn new(snapshot: &DeltaTableState) -> Self {
let invariants = snapshot.schema().get_invariants().unwrap_or_default();
let constraints = snapshot.table_config().get_constraints();
let non_nullable_columns = snapshot.schema().fields().filter_map(|f|{
if !f.is_nullable() {
Some(f.name().clone())
} else {
None
}
}).collect_vec();
let non_nullable_columns = snapshot
.schema()
.fields()
.filter_map(|f| {
if !f.is_nullable() {
Some(f.name().clone())
} else {
None
}
})
.collect_vec();
Self {
invariants,
constraints,
Expand All @@ -1226,7 +1230,7 @@ impl DeltaDataChecker {
/// If it does not, it will return [DeltaTableError::InvalidData] with a list
/// of values that violated each invariant.
pub async fn check_batch(&self, record_batch: &RecordBatch) -> Result<(), DeltaTableError> {
let _ = self.check_nullability(record_batch, &self.non_nullable_columns)?;
self.check_nullability(record_batch, &self.non_nullable_columns)?;
self.enforce_checks(record_batch, &self.invariants).await?;
self.enforce_checks(record_batch, &self.constraints).await
}
Expand All @@ -1235,7 +1239,7 @@ impl DeltaDataChecker {
&self,
record_batch: &RecordBatch,
non_nullable_columns: &Vec<String>,
) -> Result<(), DeltaTableError> {
) -> Result<(), DeltaTableError> {
let mut violations = Vec::new();
for col in non_nullable_columns {
if let Some(arr) = record_batch.column_by_name(col) {
Expand Down

0 comments on commit f984855

Please sign in to comment.