Skip to content

Commit

Permalink
fix(typo): unqualifed to unqualified (#11159)
Browse files Browse the repository at this point in the history
* fix(typo): unqualifed to unqualified

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* keep the old API

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* Update datafusion/common/src/dfschema.rs

Co-authored-by: Oleks V <comphead@users.noreply.github.com>

---------

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
Co-authored-by: Oleks V <comphead@users.noreply.github.com>
  • Loading branch information
waynexia and comphead authored Jun 29, 2024
1 parent 7a7797c commit c80da91
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 22 deletions.
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",
note = "Please use `from_unqualified_fields` instead (this one's name is a typo). This method is subject to be removed soon"
)]
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 @@ -2763,7 +2763,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

0 comments on commit c80da91

Please sign in to comment.