gianm opened a new pull request, #18521:
URL: https://github.com/apache/druid/pull/18521
Adds two virtual columns:
1) NestedMergeVirtualColumn, for `json_merge`.
2) NestedObjectVirtualColumn, for `json_object`.
Both of these functions return nested objects. Previously, it was not
possible for a virtual column to act as a nested column, so this patch also
adds machinery to make this possible. Specifically:
1) `ColumnCache` is updated to return holders for both physical and
virtual columns. The subclass `BaseColumnHolder` is used when the column
is guaranteed to be a physical column, to minimize the need for casting.
2) `ColumnCache` is made into a `ColumnIndexSelector`, and
`ColumnSelectorColumnIndexSelector`
is removed.
3) `VirtualColumn` is updated to have a single method for creating each
selector, accepting both `ColumnSelector` and `ColumnSelectorFactory`
(instead
of two methods, one accepting each). This is needed because when virtual
nested columns are stacked on each other, some levels need one and some
levels need the other. For example: `json_merge(nested, json_object(...)`.
This patch also includes an update to the expr implementation of
`json_merge` to avoid needless round-trips to JSON strings. Previously, when
processing an object, it would convert the object to a JSON string and then
parse it again. The new tests validate that error-case behavior remains the
same.
--
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]