Skip to content
Merged
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
51 changes: 17 additions & 34 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,30 +89,30 @@ version = "55.1.0"
#
# See for more details: https://github.com/rust-lang/cargo/issues/11329
apache-avro = { version = "0.21", default-features = false }
arrow = { version = "59.2.0", features = [
arrow = { git = "https://github.com/Embucket/arrow-rs.git", rev = "4aee61ac7892a32a832d0cef2d21886e2a0adcc0", features = [
"prettyprint",
"chrono-tz",
] }
arrow-avro = { version = "59.2.0", default-features = false, features = [
arrow-avro = { git = "https://github.com/Embucket/arrow-rs.git", rev = "4aee61ac7892a32a832d0cef2d21886e2a0adcc0", default-features = false, features = [
"deflate",
"snappy",
"zstd",
"bzip2",
"xz",
] }
arrow-buffer = { version = "59.2.0", default-features = false }
arrow-data = { version = "59.2.0", default-features = false }
arrow-flight = { version = "59.2.0", features = [
arrow-buffer = { git = "https://github.com/Embucket/arrow-rs.git", rev = "4aee61ac7892a32a832d0cef2d21886e2a0adcc0", default-features = false }
arrow-data = { git = "https://github.com/Embucket/arrow-rs.git", rev = "4aee61ac7892a32a832d0cef2d21886e2a0adcc0", default-features = false }
arrow-flight = { git = "https://github.com/Embucket/arrow-rs.git", rev = "4aee61ac7892a32a832d0cef2d21886e2a0adcc0", features = [
"flight-sql-experimental",
] }
# Both codecs are required here to make sure that code paths like
# file-spilling have access to all compression codecs.
arrow-ipc = { version = "59.2.0", default-features = false, features = [
arrow-ipc = { git = "https://github.com/Embucket/arrow-rs.git", rev = "4aee61ac7892a32a832d0cef2d21886e2a0adcc0", default-features = false, features = [
"lz4",
"zstd",
] }
arrow-ord = { version = "59.2.0", default-features = false }
arrow-schema = { version = "59.2.0", default-features = false }
arrow-ord = { git = "https://github.com/Embucket/arrow-rs.git", rev = "4aee61ac7892a32a832d0cef2d21886e2a0adcc0", default-features = false }
arrow-schema = { git = "https://github.com/Embucket/arrow-rs.git", rev = "4aee61ac7892a32a832d0cef2d21886e2a0adcc0", default-features = false }
async-trait = "0.1.89"
bigdecimal = "0.4.8"
bytes = "1.11"
Expand Down Expand Up @@ -178,7 +178,7 @@ memchr = "2.8.1"
num-traits = { version = "0.2" }
object_store = { version = "0.13.2", default-features = false }
parking_lot = "0.12"
parquet = { version = "59.2.0", default-features = false, features = [
parquet = { git = "https://github.com/Embucket/arrow-rs.git", rev = "4aee61ac7892a32a832d0cef2d21886e2a0adcc0", default-features = false, features = [
"arrow",
"async",
"object_store",
Expand Down
21 changes: 19 additions & 2 deletions datafusion/datasource-csv/src/file_format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use std::sync::Arc;
use crate::source::CsvSource;

use arrow::array::RecordBatch;
use arrow::csv::WriterBuilder;
use arrow::csv::{CsvRecordErrorHandler, WriterBuilder};
use arrow::datatypes::{DataType, Field, Fields, Schema, SchemaRef};
use arrow::error::ArrowError;
use datafusion_common::config::{ConfigField, ConfigFileType, CsvOptions};
Expand Down Expand Up @@ -134,6 +134,7 @@ impl GetExt for CsvFormatFactory {
#[derive(Debug, Default)]
pub struct CsvFormat {
options: CsvOptions,
record_error_handler: Option<Arc<dyn CsvRecordErrorHandler>>,
}

impl CsvFormat {
Expand Down Expand Up @@ -200,6 +201,18 @@ impl CsvFormat {
self
}

/// Skip malformed field-count records and report them to `handler`.
///
/// This recovery path retains source record bytes and disables file range
/// repartitioning. The default strict path is unchanged.
pub fn with_record_error_handler(
mut self,
handler: Arc<dyn CsvRecordErrorHandler>,
) -> Self {
self.record_error_handler = Some(handler);
self
}

/// Retrieve the csv options
pub fn options(&self) -> &CsvOptions {
&self.options
Expand Down Expand Up @@ -494,7 +507,11 @@ impl FileFormat for CsvFormat {
if csv_options.has_header.is_none() {
csv_options.has_header = Some(true);
}
Arc::new(CsvSource::new(table_schema).with_csv_options(csv_options))
let mut source = CsvSource::new(table_schema).with_csv_options(csv_options);
if let Some(handler) = &self.record_error_handler {
source = source.with_record_error_handler(Arc::clone(handler));
}
Arc::new(source)
}
}

Expand Down
Loading
Loading