paul-rogers commented on issue #12546:
URL: https://github.com/apache/druid/issues/12546#issuecomment-1196204003

   @clint, thanks for the head's up on the complex types. Can you point me to 
documentation on the details of the type? To any SQL support we already have?
   
   One question is whether a `COMPLEX<json>` column is logically one opaque 
"blob" (with whatever data appeared on input), or is a [compound 
type](https://www.postgresql.org/docs/current/rowtypes.html) where the user 
defines the fields.
   
   If a JSON column is a blob, then we could look at the 
[Drill](https://drill.apache.org/docs/supported-data-types/#composite-types) 
`MAP` type: where a column `foo` is simply declared as type `MAP`, which then 
enables a set of operations and functions, just like any other type. Presumably 
we'd implement something like the 
[Postgres](https://www.postgresql.org/docs/9.5/functions-json.html) JSON 
functions, which are based on the SQL standard.
   
   If the user must declare the structure of a JSON object, then we do have a 
compound type. In that case, each column is, itself, a record, and can have a 
nested schema, to however many levels we choose to support. (Experience with 
Drill showed that users ability to deal with schema is limited when it is one 
level, and rapidly falls to zero when schemas are nested: most of us just don't 
want to think that hard!)
   
   Regardless of how we proceed, we can use the Posgres JSON operators to 
access fields within a JSON blob, but that would require Calcite parser 
changes. On the other hand, Drill did coax Calcite into allowing references to 
`MAP` columns that look like table record references: 
`myTable.myMap.myNestedMap.myValue`. Regardless of syntax, these would 
translate internally into functions, maybe `json_get(col, path)` or some such. 
Perhaps you've already implemented these functions?


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