Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(typo): unqualifed to unqualified #11159

Merged
merged 3 commits into from
Jun 29, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions datafusion-examples/examples/expr_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,14 +292,14 @@ fn expression_type_demo() -> Result<()> {
// types of the input expressions. You can provide this information using
// a schema. In this case we create a schema where the column `c` is of
// type Utf8 (a String / VARCHAR)
let schema = DFSchema::from_unqualifed_fields(
let schema = DFSchema::from_unqualified_fields(
vec![Field::new("c", DataType::Utf8, true)].into(),
HashMap::new(),
)?;
assert_eq!("Utf8", format!("{}", expr.get_type(&schema).unwrap()));

// Using a schema where the column `foo` is of type Int32
let schema = DFSchema::from_unqualifed_fields(
let schema = DFSchema::from_unqualified_fields(
vec![Field::new("c", DataType::Int32, true)].into(),
HashMap::new(),
)?;
Expand All @@ -308,7 +308,7 @@ fn expression_type_demo() -> Result<()> {
// Get the type of an expression that adds 2 columns. Adding an Int32
// and Float32 results in Float32 type
let expr = col("c1") + col("c2");
let schema = DFSchema::from_unqualifed_fields(
let schema = DFSchema::from_unqualified_fields(
vec![
Field::new("c1", DataType::Int32, true),
Field::new("c2", DataType::Float32, true),
Expand Down
15 changes: 14 additions & 1 deletion datafusion/common/src/dfschema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ pub type DFSchemaRef = Arc<DFSchema>;
/// use arrow::datatypes::Field;
/// use std::collections::HashMap;
///
/// let df_schema = DFSchema::from_unqualifed_fields(vec![
/// let df_schema = DFSchema::from_unqualified_fields(vec![
/// Field::new("c1", arrow::datatypes::DataType::Int32, false),
/// ].into(),HashMap::new()).unwrap();
/// let schema = Schema::from(df_schema);
Expand Down Expand Up @@ -159,6 +159,19 @@ impl DFSchema {
}

/// Create a new `DFSchema` from a list of Arrow [Field]s
#[allow(deprecated)]
pub fn from_unqualified_fields(
fields: Fields,
metadata: HashMap<String, String>,
) -> Result<Self> {
Self::from_unqualifed_fields(fields, metadata)
}

/// Create a new `DFSchema` from a list of Arrow [Field]s
#[deprecated(
since = "40.0.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 wow what a typo

note = "Please use `from_unqualified_fields` instead (this one's name is a typo)"
waynexia marked this conversation as resolved.
Show resolved Hide resolved
)]
pub fn from_unqualifed_fields(
fields: Fields,
metadata: HashMap<String, String>,
Expand Down
2 changes: 1 addition & 1 deletion datafusion/core/src/datasource/listing/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ async fn prune_partitions(
.collect();
let schema = Arc::new(Schema::new(fields));

let df_schema = DFSchema::from_unqualifed_fields(
let df_schema = DFSchema::from_unqualified_fields(
partition_cols
.iter()
.map(|(n, d)| Field::new(n, d.clone(), true))
Expand Down
2 changes: 1 addition & 1 deletion datafusion/core/src/physical_planner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2752,7 +2752,7 @@ mod tests {
fn default() -> Self {
Self {
schema: DFSchemaRef::new(
DFSchema::from_unqualifed_fields(
DFSchema::from_unqualified_fields(
vec![Field::new("a", DataType::Int32, false)].into(),
HashMap::new(),
)
Expand Down
4 changes: 2 additions & 2 deletions datafusion/expr/src/expr_schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ impl ExprSchemable for Expr {
///
/// fn main() {
/// let expr = col("c1") + col("c2");
/// let schema = DFSchema::from_unqualifed_fields(
/// let schema = DFSchema::from_unqualified_fields(
/// vec![
/// Field::new("c1", DataType::Int32, true),
/// Field::new("c2", DataType::Float32, true),
Expand Down Expand Up @@ -668,7 +668,7 @@ mod tests {
.unwrap()
);

let schema = DFSchema::from_unqualifed_fields(
let schema = DFSchema::from_unqualified_fields(
vec![Field::new("foo", DataType::Int32, true).with_metadata(meta.clone())]
.into(),
HashMap::new(),
Expand Down
2 changes: 1 addition & 1 deletion datafusion/expr/src/logical_plan/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ impl LogicalPlanBuilder {
Field::new(name, data_type.clone(), true)
})
.collect::<Vec<_>>();
let dfschema = DFSchema::from_unqualifed_fields(fields.into(), HashMap::new())?;
let dfschema = DFSchema::from_unqualified_fields(fields.into(), HashMap::new())?;
let schema = DFSchemaRef::new(dfschema);
Ok(Self::from(LogicalPlan::Values(Values { schema, values })))
}
Expand Down
2 changes: 1 addition & 1 deletion datafusion/expr/src/logical_plan/plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2080,7 +2080,7 @@ impl SubqueryAlias {
let fields = change_redundant_column(plan.schema().fields());
let meta_data = plan.schema().as_ref().metadata().clone();
let schema: Schema =
DFSchema::from_unqualifed_fields(fields.into(), meta_data)?.into();
DFSchema::from_unqualified_fields(fields.into(), meta_data)?.into();
// Since schema is the same, other than qualifier, we can use existing
// functional dependencies:
let func_dependencies = plan.schema().functional_dependencies().clone();
Expand Down
12 changes: 6 additions & 6 deletions datafusion/optimizer/src/analyzer/type_coercion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,7 @@ mod test {
Arc::new(LogicalPlan::EmptyRelation(EmptyRelation {
produce_one_row: false,
schema: Arc::new(
DFSchema::from_unqualifed_fields(
DFSchema::from_unqualified_fields(
vec![Field::new("a", data_type, true)].into(),
std::collections::HashMap::new(),
)
Expand Down Expand Up @@ -1081,7 +1081,7 @@ mod test {
let expr = col("a").in_list(vec![lit(1_i32), lit(4_i8), lit(8_i64)], false);
let empty = Arc::new(LogicalPlan::EmptyRelation(EmptyRelation {
produce_one_row: false,
schema: Arc::new(DFSchema::from_unqualifed_fields(
schema: Arc::new(DFSchema::from_unqualified_fields(
vec![Field::new("a", DataType::Decimal128(12, 4), true)].into(),
std::collections::HashMap::new(),
)?),
Expand Down Expand Up @@ -1278,7 +1278,7 @@ mod test {
#[test]
fn test_type_coercion_rewrite() -> Result<()> {
// gt
let schema = Arc::new(DFSchema::from_unqualifed_fields(
let schema = Arc::new(DFSchema::from_unqualified_fields(
vec![Field::new("a", DataType::Int64, true)].into(),
std::collections::HashMap::new(),
)?);
Expand All @@ -1289,7 +1289,7 @@ mod test {
assert_eq!(expected, result);

// eq
let schema = Arc::new(DFSchema::from_unqualifed_fields(
let schema = Arc::new(DFSchema::from_unqualified_fields(
vec![Field::new("a", DataType::Int64, true)].into(),
std::collections::HashMap::new(),
)?);
Expand All @@ -1300,7 +1300,7 @@ mod test {
assert_eq!(expected, result);

// lt
let schema = Arc::new(DFSchema::from_unqualifed_fields(
let schema = Arc::new(DFSchema::from_unqualified_fields(
vec![Field::new("a", DataType::Int64, true)].into(),
std::collections::HashMap::new(),
)?);
Expand Down Expand Up @@ -1373,7 +1373,7 @@ mod test {

#[test]
fn test_case_expression_coercion() -> Result<()> {
let schema = Arc::new(DFSchema::from_unqualifed_fields(
let schema = Arc::new(DFSchema::from_unqualified_fields(
vec![
Field::new("boolean", DataType::Boolean, true),
Field::new("integer", DataType::Int32, true),
Expand Down
6 changes: 3 additions & 3 deletions datafusion/optimizer/src/common_subexpr_eliminate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1702,7 +1702,7 @@ mod test {
fn test_extract_expressions_from_grouping_set() -> Result<()> {
let mut result = Vec::with_capacity(3);
let grouping = grouping_set(vec![vec![col("a"), col("b")], vec![col("c")]]);
let schema = DFSchema::from_unqualifed_fields(
let schema = DFSchema::from_unqualified_fields(
vec![
Field::new("a", DataType::Int32, false),
Field::new("b", DataType::Int32, false),
Expand All @@ -1721,7 +1721,7 @@ mod test {
fn test_extract_expressions_from_grouping_set_with_identical_expr() -> Result<()> {
let mut result = Vec::with_capacity(2);
let grouping = grouping_set(vec![vec![col("a"), col("b")], vec![col("a")]]);
let schema = DFSchema::from_unqualifed_fields(
let schema = DFSchema::from_unqualified_fields(
vec![
Field::new("a", DataType::Int32, false),
Field::new("b", DataType::Int32, false),
Expand Down Expand Up @@ -1790,7 +1790,7 @@ mod test {
#[test]
fn test_extract_expressions_from_col() -> Result<()> {
let mut result = Vec::with_capacity(1);
let schema = DFSchema::from_unqualifed_fields(
let schema = DFSchema::from_unqualified_fields(
vec![Field::new("a", DataType::Int32, false)].into(),
HashMap::default(),
)?;
Expand Down
2 changes: 1 addition & 1 deletion datafusion/optimizer/src/propagate_empty_relation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ mod tests {

let empty = LogicalPlan::EmptyRelation(EmptyRelation {
produce_one_row: false,
schema: Arc::new(DFSchema::from_unqualifed_fields(
schema: Arc::new(DFSchema::from_unqualified_fields(
fields.into(),
Default::default(),
)?),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3005,7 +3005,7 @@ mod tests {

fn expr_test_schema() -> DFSchemaRef {
Arc::new(
DFSchema::from_unqualifed_fields(
DFSchema::from_unqualified_fields(
vec![
Field::new("c1", DataType::Utf8, true),
Field::new("c2", DataType::Boolean, true),
Expand Down
2 changes: 1 addition & 1 deletion datafusion/optimizer/src/unwrap_cast_in_comparison.rs
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,7 @@ mod tests {

fn expr_test_schema() -> DFSchemaRef {
Arc::new(
DFSchema::from_unqualifed_fields(
DFSchema::from_unqualified_fields(
vec![
Field::new("c1", DataType::Int32, false),
Field::new("c2", DataType::Int64, false),
Expand Down
Loading