Skip to content

Add hooks to SchemaAdapter to add custom column generators #15261

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

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion datafusion-testing
10 changes: 2 additions & 8 deletions datafusion/core/src/datasource/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,8 @@ mod tests {
]);

let adapter = DefaultSchemaAdapterFactory::from_schema(Arc::new(table_schema));
let (mapper, indices) = adapter.map_schema(&file_schema).unwrap();
assert_eq!(indices, vec![0]);

let file_batch = record_batch!(("b", Float64, vec![1.0, 2.0])).unwrap();

// Mapping fails because it tries to fill in a non-nullable column with nulls
let err = mapper.map_batch(file_batch).unwrap_err().to_string();
assert!(err.contains("Invalid argument error: Column 'a' is declared as non-nullable but contains null values"), "{err}");
let err = adapter.map_schema(&file_schema).unwrap_err().to_string();
assert!(err.contains("Error during planning: Column a is missing from the file schema, cannot be generated, and is non-nullable"));
}

#[derive(Debug)]
Expand Down
Loading