Skip to content

Commit 494de16

Browse files
committed
Remove unused as_any method from schema adapter implementations
1 parent d116e02 commit 494de16

File tree

6 files changed

+2
-42
lines changed

6 files changed

+2
-42
lines changed

datafusion/core/src/datasource/listing/table.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2912,10 +2912,6 @@ mod tests {
29122912
error_type: self.error_type,
29132913
})
29142914
}
2915-
2916-
fn as_any(&self) -> &dyn Any {
2917-
self
2918-
}
29192915
}
29202916

29212917
#[derive(Debug)]
@@ -2964,10 +2960,6 @@ mod tests {
29642960
schema: projected_table_schema,
29652961
})
29662962
}
2967-
2968-
fn as_any(&self) -> &dyn Any {
2969-
self
2970-
}
29712963
}
29722964

29732965
#[derive(Debug)]

datafusion/core/src/datasource/mod.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ mod tests {
7171
};
7272
use datafusion_datasource_parquet::source::ParquetSource;
7373
use datafusion_physical_plan::collect;
74-
use std::{any::Any, fs, sync::Arc};
74+
use std::{fs, sync::Arc};
7575
use tempfile::TempDir;
7676

7777
#[tokio::test]
@@ -214,10 +214,6 @@ mod tests {
214214
table_schema: projected_table_schema,
215215
})
216216
}
217-
218-
fn as_any(&self) -> &dyn Any {
219-
self
220-
}
221217
}
222218

223219
struct TestSchemaAdapter {

datafusion/core/tests/parquet/schema_adapter.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18-
use std::any::Any;
1918
use std::sync::Arc;
2019

2120
use arrow::array::{record_batch, RecordBatch, RecordBatchOptions};
@@ -43,15 +42,6 @@ use itertools::Itertools;
4342
use object_store::{memory::InMemory, path::Path, ObjectStore};
4443
use parquet::arrow::ArrowWriter;
4544

46-
#[cfg(feature = "parquet")]
47-
use datafusion::datasource::physical_plan::ParquetSource;
48-
use datafusion::datasource::physical_plan::{
49-
ArrowSource, CsvSource, FileScanConfigBuilder, FileSource, JsonSource,
50-
};
51-
use datafusion::datasource::source::DataSourceExec;
52-
use datafusion::physical_plan::ExecutionPlan;
53-
use datafusion_datasource::PartitionedFile;
54-
5545
async fn write_parquet(batch: RecordBatch, store: Arc<dyn ObjectStore>, path: &str) {
5646
let mut out = BytesMut::new().writer();
5747
{
@@ -76,10 +66,6 @@ impl SchemaAdapterFactory for CustomSchemaAdapterFactory {
7666
logical_file_schema: projected_table_schema,
7767
})
7868
}
79-
80-
fn as_any(&self) -> &dyn Any {
81-
self
82-
}
8369
}
8470

8571
#[derive(Debug)]

datafusion/datasource-parquet/src/opener.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,10 +1213,6 @@ mod test {
12131213
) -> Box<dyn SchemaAdapter> {
12141214
Box::new(CustomSchemaAdapter)
12151215
}
1216-
1217-
fn as_any(&self) -> &dyn std::any::Any {
1218-
self
1219-
}
12201216
}
12211217

12221218
// Test that if no expression rewriter is provided we use a schemaadapter to adapt the data to the expresssion

datafusion/datasource-parquet/tests/apply_schema_adapter_tests.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,6 @@ mod parquet_adapter_tests {
4747
prefix: self.prefix.clone(),
4848
})
4949
}
50-
51-
fn as_any(&self) -> &dyn std::any::Any {
52-
self
53-
}
5450
}
5551

5652
/// A test schema adapter that adds prefix to column names

datafusion/datasource/src/schema_adapter.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use datafusion_common::{
2929
nested_struct::{cast_column, validate_struct_compatibility},
3030
plan_err, ColumnStatistics,
3131
};
32-
use std::{any::Any, fmt::Debug, sync::Arc};
32+
use std::{fmt::Debug, sync::Arc};
3333
/// Function used by [`SchemaMapping`] to adapt a column from the file schema to
3434
/// the table schema.
3535
pub type CastColumnFn =
@@ -68,8 +68,6 @@ pub trait SchemaAdapterFactory: Debug + Send + Sync + 'static {
6868
) -> Box<dyn SchemaAdapter> {
6969
self.create(Arc::clone(&projected_table_schema), projected_table_schema)
7070
}
71-
/// Give us access to Any so callers can downcast.
72-
fn as_any(&self) -> &dyn Any;
7371
}
7472

7573
/// Creates [`SchemaMapper`]s to map file-level [`RecordBatch`]es to a table
@@ -234,10 +232,6 @@ impl SchemaAdapterFactory for DefaultSchemaAdapterFactory {
234232
projected_table_schema,
235233
})
236234
}
237-
238-
fn as_any(&self) -> &dyn Any {
239-
self
240-
}
241235
}
242236

243237
/// This SchemaAdapter requires both the table schema and the projected table

0 commit comments

Comments
 (0)