crm26 opened a new pull request, #1466:
URL: https://github.com/apache/datafusion-python/pull/1466
## Which issue does this PR close?
Closes N/A — new feature request.
## Rationale
DataFusion Python users currently have no way to query JSON fields in SQL.
The `datafusion-functions-json` crate (under `datafusion-contrib`) provides
`json_extract`, `json_get`, `->`, `->>` and other JSON operators, but these are
only available in Rust. This PR exposes them to Python users via an optional
feature flag.
## What changes are included in this PR?
- Add `datafusion-functions-json` (v0.53) to workspace dependencies
- Add optional dependency and `json` feature flag to core crate
- Register JSON functions in `SessionContext` creation when feature is
enabled
3 files changed, 11 insertions.
## Are these changes tested?
Not yet — requesting feedback on approach before adding tests. Tests would
verify:
- `json_extract_string(col, '$.path')` works in SQL queries
- Default build (no `json` feature) compiles and runs without regression
- JSON functions are available immediately after `SessionContext()` creation
## Are there any user-facing changes?
When built with `--features json`:
```python
from datafusion import SessionContext
ctx = SessionContext()
# JSON extraction now available in SQL
result = ctx.sql("""
SELECT json_extract_string(data, '$.address.state') as state,
COUNT(*) as cnt
FROM my_table
GROUP BY state
""").collect()
```
Default builds are unaffected.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
--
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]