Skip to content

Commit

Permalink
add tests to make sure it cant coerce diff sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
universalmind303 committed Mar 5, 2024
1 parent 46f26de commit 454ed42
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions datafusion/expr/src/type_coercion/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -522,18 +522,29 @@ mod tests {
let current_types = vec![
DataType::FixedSizeList(inner.clone(), 2), // able to coerce for any size
];

let signature = Signature::exact(
vec![DataType::FixedSizeList(
inner.clone(),
FIXED_SIZE_LIST_WILDCARD,
)],
Volatility::Stable,
);

let coerced_data_types = data_types(&current_types, &signature).unwrap();
assert_eq!(coerced_data_types, current_types);

// make sure it can't coerce to a different size
let signature = Signature::exact(
vec![DataType::FixedSizeList(inner.clone(), 3)],
Volatility::Stable,
);
let coerced_data_types = data_types(&current_types, &signature);
assert!(coerced_data_types.is_err());

Ok(())
}

#[test]
fn test_nested_wildcard_fixed_size_lists() -> Result<()> {
let type_into = DataType::FixedSizeList(
Expand Down

0 comments on commit 454ed42

Please sign in to comment.