feat(csv): expose CsvReadOptions via registerCsv and readCsv#21
Merged
Conversation
Mirror the parquet pattern (apache#18, apache#19): add CsvReadOptions builder, four SessionContext methods (registerCsv x2, readCsv x2), and JNI plumbing in native/src/csv.rs. Builder exposes the subset of DataFusion's Rust CsvReadOptions that has a parquet analog already on the Java side -- header, delimiter, quote, escape, terminator, comment, newlinesInValues, schemaInferMaxRecords, fileExtension, fileCompressionType, and explicit Arrow schema. Tests cover: option-builder fluent API, header-inferred schema with SQL round-trip, explicit-schema header-less file with custom delimiter, and a custom file extension with a tab delimiter. table_partition_cols, file_sort_order, null_regex and truncated_rows are intentionally deferred -- they have no parquet-side counterpart yet on the Java side.
Contributor
Author
|
@andygrove glad to see we have a official java binding repo, I'd like to do some contributions. |
This was referenced May 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Summary
Mirror the parquet pattern (#18, #19): add
CsvReadOptionsbuilder, fourSessionContextmethods (registerCsvx2,readCsvx2), and JNI plumbing in native/src/csv.rs. Builder exposes the subset of DataFusion's RustCsvReadOptionsthat has a parquet analog already on the Java side -- header, delimiter, quote, escape, terminator, comment, newlinesInValues, schemaInferMaxRecords, fileExtension, fileCompressionType, and explicit Arrow schema.Tests cover: option-builder fluent API, header-inferred schema with SQL round-trip, explicit-schema header-less file with custom delimiter, and a custom file extension with a tab delimiter.
table_partition_cols,file_sort_order,null_regexandtruncated_rowsare intentionally deferred -- they have no parquet-side counterpart yet on the Java side.Changes
CsvReadOptionsbuilder mirroring the subset of Rustdatafusion::prelude::CsvReadOptionsthat has a Parquet analog alreadyexposed in this repo: header, delimiter, quote, escape, terminator,
comment, newlinesInValues, schemaInferMaxRecords, fileExtension,
fileCompressionType, and explicit Arrow
schema.SessionContext.registerCsv(...)/readCsv(...)overloads,matching the shape of
registerParquet/readParquet.native/src/lib.rs, sharing theschema-IPC-serialization helper already used by the Parquet path.
tablePartitionCols,fileSortOrder,nullRegex, andtruncatedRowsare intentionally deferred to a follow-up; they have no Parquet-side counterpart yet on the Java side and were called out in the issue as out-of-scope.Test plan
./mvnw test— newCsvReadOptionsTest(option-builder) passes../mvnw test— newSessionContextCsvTestpasses:registerCsv+ SQL round-trip on an inferred-schema filereadCsvwith explicit Arrow schema andhasHeader(false)make test— full native + JVM build is green.cargo fmtandcargo clippy --all-targets -- -D warningsclean undernative/../mvnw spotless:applyclean.