You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "samuelcolvin (via GitHub)" <gi...@apache.org> on 2024/04/23 23:55:19 UTC

Re: [I] Any plan to support JSON or JSONB? [datafusion]

samuelcolvin commented on issue #7845:
URL: https://github.com/apache/datafusion/issues/7845#issuecomment-2073675288

   https://github.com/datafusion-contrib/datafusion-functions-json now provides the following methods, are think we're nearly ready for a first release, see https://github.com/datafusion-contrib/datafusion-functions-json/issues/5.
   
   * [x] `json_contains(json: str, *keys: str | int) -> bool` - true if a JSON object has a specific key
   * [x] `json_get(json: str, *keys: str | int) -> JsonUnion` - Get a value from a JSON object by its "path"
   * [x] `json_get_str(json: str, *keys: str | int) -> str` - Get a string value from a JSON object by its "path"
   * [x] `json_get_int(json: str, *keys: str | int) -> int` - Get an integer value from a JSON object by its "path"
   * [x] `json_get_float(json: str, *keys: str | int) -> float` - Get a float value from a JSON object by its "path"
   * [x] `json_get_bool(json: str, *keys: str | int) -> bool` - Get a boolean value from a JSON object by its "path"
   * [x] `json_get_json(json: str, *keys: str | int) -> str` - Get any value from a JSON object by its "path", represented as a string
   * [x] `json_length(json: str, *keys: str | int) -> int` - get the length of a JSON object or array
   
   Cast expressions with `json_get` are rewritten to the appropriate method, e.g.
   
   ```sql
   select * from foo where json_get(attributes, 'bar')::string='ham'
   ```
   Will be rewritten to:
   ```sql
   select * from foo where json_get_str(attributes, 'bar')='ham'
   ```


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org