Skip to content

Commit

Permalink
improve comment
Browse files Browse the repository at this point in the history
Signed-off-by: jayzhan211 <[email protected]>
  • Loading branch information
jayzhan211 committed Dec 4, 2023
1 parent 8616b76 commit 8483b76
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
24 changes: 13 additions & 11 deletions datafusion/common/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ pub fn base_type(data_type: &DataType) -> DataType {
}
}

/// Coerced only the base type.
/// A helper function to coerce base type in List.
///
/// Example
/// ```
Expand All @@ -444,18 +444,20 @@ pub fn coerced_type_with_base_type_only(
base_type: &DataType,
) -> DataType {
match data_type {
DataType::List(field) => match field.data_type() {
DataType::List(_) => DataType::List(Arc::new(Field::new(
field.name(),
coerced_type_with_base_type_only(field.data_type(), base_type),
field.is_nullable(),
))),
_ => DataType::List(Arc::new(Field::new(
DataType::List(field) => {
let data_type = match field.data_type() {
DataType::List(_) => {
coerced_type_with_base_type_only(field.data_type(), base_type)
}
_ => base_type.to_owned(),
};

DataType::List(Arc::new(Field::new(
field.name(),
base_type.clone(),
data_type,
field.is_nullable(),
))),
},
)))
}

_ => base_type.clone(),
}
Expand Down
6 changes: 4 additions & 2 deletions datafusion/expr/src/signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,16 @@ impl TypeSignature {
.collect::<Vec<&str>>()
.join(", ")]
}
TypeSignature::VariadicCoerced => vec!["CoercibleT, .., CoercibleT".to_string()],
TypeSignature::VariadicCoerced => {
vec!["CoercibleT, .., CoercibleT".to_string()]
}
TypeSignature::VariadicEqual => vec!["T, .., T".to_string()],
TypeSignature::VariadicAny => vec!["Any, .., Any".to_string()],
TypeSignature::OneOf(sigs) => {
sigs.iter().flat_map(|s| s.to_string_repr()).collect()
}
TypeSignature::ArrayAppendLikeSignature => {
vec!["ArrayAppendLikeSignature".to_string()]
vec!["ArrayAppendLikeSignature(List<T>, T)".to_string()]
}
}
}
Expand Down

0 comments on commit 8483b76

Please sign in to comment.