Commit bfa14f4
refactor(context): deduplicate register/read option-building logic (#1479)
* refactor(context): deduplicate register/read option-building logic
Extract shared helpers (convert_partition_cols, convert_file_sort_order,
build_parquet/json/avro_options, convert_csv_options), standardize path
types to &str, and remove redundant intermediate variables.
* refactor(context): accept PathBuf for path arguments in register/read methods
Change path parameters from &str to PathBuf in all register/read methods
(register_listing_table, register_parquet, register_json, register_avro,
register_arrow, read_json, read_parquet, read_avro, read_arrow) so callers
can pass either a Python str or a pathlib.Path object. For register_csv and
read_csv, which take &Bound<PyAny> to handle lists, extract path elements as
PathBuf rather than String for the same reason.
Add a path_to_str helper that converts PathBuf to &str, returning an explicit
error for non-UTF-8 paths rather than silently corrupting them.
Add build_arrow_options helper to deduplicate register_arrow/read_arrow
option-building logic, consistent with the existing parquet/json/avro helpers.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 23062f7 commit bfa14f4
2 files changed
Lines changed: 196 additions & 195 deletions
0 commit comments