adriangb commented on issue #21301:
URL: https://github.com/apache/datafusion/issues/21301#issuecomment-4171338058

   > **Summary of Major Exact Diffs**
   
   None of these seem like real issues to me.
   
   >     * DF works on raw `text`/`str` JSON; Postgres requires `::json` or 
(preferred) `::jsonb`.
   
   Yes, that's just the reality of it. Once we have proper extension types 
we'll have something very similar to `::json`. Variant is similar to `::jsonb`.
   
   >     * DF path syntax: variadic `*keys` (mix of `str` + `int` indices) → 
Postgres: `text[]` array or chained operators (indices as text strings `'0'`, 
`'1'`).
   
   Our version seems more ergonomic? We could also accept a single `text[]`. 
Maybe we need to accept `'2'` for array indexing.
   
   >     * DF has **typed getters** (`_int`, `_float`, etc.); Postgres has 
**none** — always text extract + SQL cast.
   
   Yes, this is so that we can avoid an intermediary conversion. These don't 
need to be user accessible, they are mostly used to rewrite `(col->'key')::int` 
into `json_get_int(col, 'key')` which is able to parse the json directly into 
an int.
   
   >     * DF `json_get_array` returns native Arrow array; Postgres returns 
`jsonb` (must expand manually).
   
   We could change this, but I'd argue our version is more ergonomic and 
performant (avoids assembling a json array which would probably require 
allocating non-json array anyway).
   
   >     * DF `json_length` is unified; Postgres splits array vs object.
   
   Again I think having 1 function is more ergonomic. We could add aliases.
   
   >     * Postgres `jsonb` is binary & indexable (GIN); DF is string-based (no 
native indexing mentioned).
   
   In general indexing in postgres != indexing in DataFusion. It's not like you 
can just create a BTree index in DataFusion in general.


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

Reply via email to