Skip to content

Commit 322f686

Browse files
Dodotherealalamb
andauthored
chore(parquet): remove deprecated schema-coercion helpers (Closes apache#23080 - partial) (apache#23132)
Removes coerce_file_schema_to_view_type and coerce_file_schema_to_string_type (both deprecated since 47.0.0 with replacement apply_file_schema_type_coercions). Zero callers in the workspace; only the function definitions and re-export entries in mod.rs / file_format.rs remain. Drops the now-unused #[expect(deprecated)] attribute on the re-export lines. Pure 118-line deletion across 3 files. Part of apache#23080 (partial - third in the housekeeping series after apache#23129 and apache#23131). AI assistance: used an AI coding assistant to identify and remove unused symbols; verified via repo-wide grep that the deprecated functions have no callers. --------- Co-authored-by: Andrew Lamb <[email protected]>
1 parent 63ad991 commit 322f686

3 files changed

Lines changed: 7 additions & 118 deletions

File tree

‎datafusion/datasource-parquet/src/file_format.rs‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@ use std::sync::Arc;
2424

2525
// Re-export so the historical `file_format::*` paths still resolve.
2626
#[expect(deprecated)]
27+
pub use crate::schema_coercion::coerce_int96_to_resolution;
2728
pub use crate::schema_coercion::{
28-
Int96Coercer, apply_file_schema_type_coercions, coerce_file_schema_to_string_type,
29-
coerce_file_schema_to_view_type, coerce_int96_to_resolution,
30-
transform_binary_to_string, transform_schema_to_view,
29+
Int96Coercer, apply_file_schema_type_coercions, transform_binary_to_string,
30+
transform_schema_to_view,
3131
};
32+
3233
pub use crate::sink::ParquetSink;
3334

3435
use arrow::datatypes::{Fields, Schema, SchemaRef};

‎datafusion/datasource-parquet/src/mod.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ pub use row_filter::build_row_filter;
5555
pub use row_filter::can_expr_be_pushed_down_with_schemas;
5656
pub use row_group_filter::RowGroupAccessPlanFilter;
5757
#[expect(deprecated)]
58+
pub use schema_coercion::coerce_int96_to_resolution;
5859
pub use schema_coercion::{
59-
Int96Coercer, apply_file_schema_type_coercions, coerce_file_schema_to_string_type,
60-
coerce_file_schema_to_view_type, coerce_int96_to_resolution,
61-
transform_binary_to_string, transform_schema_to_view,
60+
Int96Coercer, apply_file_schema_type_coercions, transform_binary_to_string,
61+
transform_schema_to_view,
6262
};
6363
pub use sink::ParquetSink;
6464
pub use virtual_column::ParquetVirtualColumn;

‎datafusion/datasource-parquet/src/schema_coercion.rs‎

Lines changed: 0 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -418,118 +418,6 @@ fn coerce_int96_to_resolution_impl(
418418
Some(transformed_schema)
419419
}
420420

421-
/// Coerces the file schema if the table schema uses a view type.
422-
#[deprecated(
423-
since = "47.0.0",
424-
note = "Use `apply_file_schema_type_coercions` instead"
425-
)]
426-
pub fn coerce_file_schema_to_view_type(
427-
table_schema: &Schema,
428-
file_schema: &Schema,
429-
) -> Option<Schema> {
430-
let mut transform = false;
431-
let table_fields: HashMap<_, _> = table_schema
432-
.fields
433-
.iter()
434-
.map(|f| {
435-
let dt = f.data_type();
436-
if dt.equals_datatype(&DataType::Utf8View)
437-
|| dt.equals_datatype(&DataType::BinaryView)
438-
{
439-
transform = true;
440-
}
441-
(f.name(), dt)
442-
})
443-
.collect();
444-
445-
if !transform {
446-
return None;
447-
}
448-
449-
let transformed_fields: Vec<Arc<Field>> = file_schema
450-
.fields
451-
.iter()
452-
.map(
453-
|field| match (table_fields.get(field.name()), field.data_type()) {
454-
(Some(DataType::Utf8View), DataType::Utf8 | DataType::LargeUtf8) => {
455-
field_with_new_type(field, DataType::Utf8View)
456-
}
457-
(
458-
Some(DataType::BinaryView),
459-
DataType::Binary | DataType::LargeBinary,
460-
) => field_with_new_type(field, DataType::BinaryView),
461-
_ => Arc::clone(field),
462-
},
463-
)
464-
.collect();
465-
466-
Some(Schema::new_with_metadata(
467-
transformed_fields,
468-
file_schema.metadata.clone(),
469-
))
470-
}
471-
472-
/// If the table schema uses a string type, coerce the file schema to use a string type.
473-
///
474-
/// See [`ParquetFormat::binary_as_string`](crate::file_format::ParquetFormat::binary_as_string) for details
475-
#[deprecated(
476-
since = "47.0.0",
477-
note = "Use `apply_file_schema_type_coercions` instead"
478-
)]
479-
pub fn coerce_file_schema_to_string_type(
480-
table_schema: &Schema,
481-
file_schema: &Schema,
482-
) -> Option<Schema> {
483-
let mut transform = false;
484-
let table_fields: HashMap<_, _> = table_schema
485-
.fields
486-
.iter()
487-
.map(|f| (f.name(), f.data_type()))
488-
.collect();
489-
let transformed_fields: Vec<Arc<Field>> = file_schema
490-
.fields
491-
.iter()
492-
.map(
493-
|field| match (table_fields.get(field.name()), field.data_type()) {
494-
// table schema uses string type, coerce the file schema to use string type
495-
(
496-
Some(DataType::Utf8),
497-
DataType::Binary | DataType::LargeBinary | DataType::BinaryView,
498-
) => {
499-
transform = true;
500-
field_with_new_type(field, DataType::Utf8)
501-
}
502-
// table schema uses large string type, coerce the file schema to use large string type
503-
(
504-
Some(DataType::LargeUtf8),
505-
DataType::Binary | DataType::LargeBinary | DataType::BinaryView,
506-
) => {
507-
transform = true;
508-
field_with_new_type(field, DataType::LargeUtf8)
509-
}
510-
// table schema uses string view type, coerce the file schema to use view type
511-
(
512-
Some(DataType::Utf8View),
513-
DataType::Binary | DataType::LargeBinary | DataType::BinaryView,
514-
) => {
515-
transform = true;
516-
field_with_new_type(field, DataType::Utf8View)
517-
}
518-
_ => Arc::clone(field),
519-
},
520-
)
521-
.collect();
522-
523-
if !transform {
524-
None
525-
} else {
526-
Some(Schema::new_with_metadata(
527-
transformed_fields,
528-
file_schema.metadata.clone(),
529-
))
530-
}
531-
}
532-
533421
/// Create a new field with the specified data type, copying the other
534422
/// properties from the input field
535423
fn field_with_new_type(field: &FieldRef, new_type: DataType) -> FieldRef {

0 commit comments

Comments
 (0)