scovich commented on issue #18717: URL: https://github.com/apache/datafusion/issues/18717#issuecomment-3553195528
> > Okay no worries. I asked because we currently have the issue that `json_column->'intkey' = 123` doesn't work, I think open variant will have the same problem? > > Hm, I don't think we'll have the same problem with variants. Variant columns use a structured representation (`StructArray`). This difference in array representation means the access patterns work differently too > > The equivalent to `json_column->'intkey'` in variant would be `variant_get(json_column, "intkey", Int32)` which directly accesses the variant data and casts it to the type you specify (`Int32` in this case) > > I _could_ be wrong so cc'ing [@alamb](https://github.com/alamb) [@scovich](https://github.com/scovich) [@klion26](https://github.com/klion26) [@liamzwbao](https://github.com/liamzwbao) I don't think I understand how `->` syntax relates to hashable union arrays or cross-type comparisons, sorry? Meanwhile tho -- I would think it's an engine decision whether variant-type columns should support the same sugar as JSON pathing (`->` here). In spark SQL, for example, the `:` sugar can be used to path into both variant and JSON columns and `variant_column:a.b.c::INT` would be equivalent to `variant_get(variant_column, "a.b.c", Int32)`. Without a `::` (= cast), it just extracts a sub-object of the same type as the input (JSON or variant). -- 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]
