jiayuasu opened a new pull request, #1044:
URL: https://github.com/apache/sedona-db/pull/1044

   Adds tabular writers `DataFrame.to_csv` and `DataFrame.to_json`, the 
write-side complement to the `read_csv`/`read_json` readers from #1034.
   
   - `to_csv(path, *, has_header=True, delimiter=",")`
   - `to_json(path)` — newline-delimited JSON (NDJSON)
   
   ## Design notes
   
   - These wrap DataFusion's native `write_csv`/`write_json` directly. Unlike 
GeoParquet (which needs the custom `write_geoparquet` trait method for 
geo-metadata handling), plain CSV/JSON need no `rust/sedona` layer — the 
asymmetry is intentional.
   - **No `single_file_output` parameter.** `write_csv`/`write_json` pass only 
`partition_by` to `copy_to` and ignore `single_file_output`, so 
file-vs-directory is driven purely by the path: a `.csv`/`.json` path is 
written as a single file; any other path is treated as a directory and written 
as one file per partition. This behavior is documented rather than exposed as a 
no-op knob.
   - **Not spatial-aware.** A geometry column is written as hex-encoded WKB (a 
legitimate interchange format — matches PostGIS CSV exports). Docstrings steer 
spatial users to `ST_AsText()` for WKT or `to_pyogrio()` for 
GeoJSON/FlatGeobuf/GeoPackage, keeping the mental model clean: spatial → 
`to_pyogrio`, tabular → `to_csv`/`to_json`, columnar → `to_parquet`.
   
   ## Tests
   
   New `tests/io/test_write_csv_json.py` (8 tests): round-trip, no-header, 
custom delimiter, bad-delimiter error, directory output, geometry-as-WKB, and 
NDJSON format. Also adds doctests to both methods.


-- 
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]

Reply via email to