Skip to content

Commit

Permalink
return error if dup partitioning field found
Browse files Browse the repository at this point in the history
  • Loading branch information
samster25 committed Dec 21, 2023
1 parent a7677d4 commit f8b63c3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/daft-scan/src/expr_rewriter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub fn rewrite_predicate_for_partitioning(
pfields: &[PartitionField],
) -> DaftResult<Option<Expr>> {
if pfields.is_empty() {
todo!("no predicate")
return Ok(None);
}

let predicate = unalias(predicate)?;
Expand All @@ -49,7 +49,10 @@ pub fn rewrite_predicate_for_partitioning(
let mut map = HashMap::with_capacity(pfields.len());
for pf in pfields.iter() {
if let Some(ref source_field) = pf.source_field {
map.insert(source_field.name.as_str(), pf);
let prev_value = map.insert(source_field.name.as_str(), pf);
if let Some(prev_value) = prev_value {
return Err(common_error::DaftError::ValueError(format!("Duplicate Partitioning Columns found on same source field: {source_field}\n1: {prev_value}\n2: {pf}")));
}
}
}
map
Expand Down

0 comments on commit f8b63c3

Please sign in to comment.