paul-rogers commented on issue #1945: DRILL-7502: Invalid codegen for typeof() 
with UNION
URL: https://github.com/apache/drill/pull/1945#issuecomment-570762571
 
 
   Another thing to note is that we may want to go though one more round of 
sorting out the type functions. In normal SQL, there is just one level of type: 
a columns is an `INT` or a `DOUBLE`.
   
   In Sqllite (IIRC) there is the `Variant` type: so a column can be `Variant` 
but the values can be `INT` or `DOUBLE`. The "variant" name comes from Visual 
Basic. In Drill, the variant is called `UNION`.
   
   In Drill, we also have structured types: `ARRAY<INTEGER>` or 
`DICT<STRING,DOUBLE>`.
   
   We've been trying to handle all these cases with originally one function 
(`typeof()`), then later three (adding `sqlTypeOf()` and `drillTypeOf()`).
   
   We probably want four variations. Two forms of the type:
   
   * The full type description: `ARRAY<ARRAY<MAP<a: INTEGER, b: VARCHAR>>>` 
say, or `UNION<DOUBLE, INTEGER>`.
   * The short type of the vector itself: `LIST`, `UNION`.
   
   For Variant types (`UNION`, `LIST`) we then want two forms:
   
   * The vector itself. (`DICT`, `MAP`, `UNION`, `LIST`)
   * The value: (`INTEGER`, `DOUBLE`).
   
   Of course, the value can itself be structured: a `UNION` which has a `LIST` 
of `UNION` types. So, for both the vector and the value, we'd want both the 
simple and verbose forms.
   
   And, now that @arina-ielchiieva added the nice type description system, we 
have no function which returns the full description, including the `NOT NULL` 
attribute, as it appears in the schema file: `INTEGER NOT NULL`.
   
   The present fix gets us closer, but it is hard to solve four or five cases 
with three functions. I suspect we could do better. Suggestions welcomed!

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to