zhuqi-lucas opened a new pull request, #19924:
URL: https://github.com/apache/datafusion/pull/19924
## Which issue does this PR close?
Closes #19920
## Rationale for this change
DataFusion currently only supports line-delimited JSON (NDJSON) format. Many
data sources provide JSON in array format `[{...}, {...}]`, which cannot be
parsed by the existing implementation.
## What changes are included in this PR?
- Add `format_array` option to `JsonOptions` to support JSON array format
- Implement schema inference for JSON array format
- Implement data reading for JSON array format
- Add protobuf serialization support for the new option
- SQL support via `OPTIONS ('format.format_array' 'true')`
## Are these changes tested?
Yes:
- Unit tests for schema inference (normal, empty array, with limit)
- Unit tests for data reading and projection
- SQLLogicTest for end-to-end SQL validation
## Are there any user-facing changes?
Yes. Users can now read JSON array format files by specifying the
`format.format_array` option:
```sql
CREATE EXTERNAL TABLE my_table
STORED AS JSON
OPTIONS ('format.format_array' 'true')
LOCATION 'path/to/array.json';
```
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]