Skip to content

Commit 05fb8db

Browse files
committed
Schema Adapter migration
1 parent 166bd18 commit 05fb8db

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

native/core/src/execution/planner.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3999,7 +3999,12 @@ mod tests {
39993999
.await?;
40004000

40014001
// Write a parquet file into temp folder
4002-
session_ctx.write_parquet(plan, test_path, None).await?;
4002+
session_ctx
4003+
.write_parquet(Arc::clone(&plan), test_path, None)
4004+
.await?;
4005+
4006+
// Get the file schema from the plan that wrote the data
4007+
let file_schema = plan.schema();
40034008

40044009
// Register all parquet with temp data as file groups
40054010
let mut file_groups: Vec<FileGroup> = vec![];
@@ -4019,13 +4024,14 @@ mod tests {
40194024
let source = Arc::new(ParquetSource::default());
40204025

40214026
let object_store_url = ObjectStoreUrl::local_filesystem();
4022-
let file_scan_config =
4023-
FileScanConfigBuilder::new(object_store_url, read_schema.clone().into(), source)
4024-
.with_file_groups(file_groups)
4025-
.build();
4027+
// Use file_schema for FileScanConfigBuilder to avoid schema validation errors
4028+
let file_scan_config = FileScanConfigBuilder::new(object_store_url, file_schema, source)
4029+
.with_file_groups(file_groups)
4030+
.build();
40264031

40274032
// Run native read
40284033
let scan = Arc::new(DataSourceExec::new(Arc::new(file_scan_config.clone())));
4034+
// ParquetSchemaAdapterExec will handle the schema transformation from file_schema to read_schema
40294035
let adapter_exec: Arc<dyn ExecutionPlan> = Arc::new(ParquetSchemaAdapterExec::new(
40304036
scan,
40314037
read_schema.into(),

0 commit comments

Comments
 (0)