jiayuasu opened a new pull request, #1034: URL: https://github.com/apache/sedona-db/pull/1034
Adds toplevel readers for delimited text and newline-delimited JSON, filling a real gap — only `read_parquet` / `read_pyogrio` existed. ## API ```python sd.read_csv(paths, *, has_header=True, delimiter=",") sd.read_json(paths) # newline-delimited JSON (NDJSON / JSON Lines) ``` - Both accept a `str` / `Path` or an iterable of paths (globs/directories per DataFusion), infer the schema, and are also available as `sd.read.csv` / `sd.read.json` alongside `sd.read.parquet` / `sd.read.pyogrio`. - `read_json` reads **newline-delimited JSON** (one object per line), not a single JSON array — documented prominently. - **Geometry is not inferred** (CSV and NDJSON carry no spatial metadata); parse WKT/WKB columns explicitly after reading (e.g. `ST_GeomFromText`). - `read_csv` validates that `delimiter` is a single byte and raises a clear error otherwise. ## Implementation | File | Change | |---|---| | `python/sedonadb/src/context.rs` | `InternalContext::read_csv` / `read_json` — thin wrappers over DataFusion's `SessionContext::read_csv` / `read_json` (`CsvReadOptions` has_header/delimiter; `NdJsonReadOptions`). | | `python/sedonadb/python/sedonadb/read.py` | `Read.csv` / `Read.json` in the reader namespace. | | `python/sedonadb/python/sedonadb/context.py` | `SedonaContext.read_csv` / `read_json` delegating to the namespace, mirroring `read_parquet`. | ## Test plan `tests/io/test_read_csv_json.py` (tmp_path files): - csv: basic, no-header, custom delimiter, multiple paths, bad-delimiter error, `read.csv` namespace form. - json: ndjson basic, multiple paths, `read.json` namespace form. Doctests on `read_csv`/`read_json` use a tempfile and show the inferred output. Local: 9 unit + 17 doctests + `ruff` + `cargo fmt --check` + `clippy -Dwarnings` all clean. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
