You couldn't query an object field directly (`fields city`,
`stats ... by city`) — the schema flattened objects into dotted leaf
columns and never added the parent, so `city` wasn't a column at all.
Add the object back as a ROW column, then rewrite each scan to read only
the leaves and rebuild the object above it in a project, using a new
`make_struct` call. The struct column can't stay in the scan: objects
have no physical storage, so FieldStorageResolver rejects it with
"Field [city] not found in field storage". Sub-objects get their own
nested `make_struct`.
To get `make_struct` over to DataFusion we build the Substrait call
ourselves instead of letting isthmus match it against a declared
signature. Isthmus wants every argument of a variadic function to be the
same type, but ours alternate between a string field name and a value of
any type, so no variadic declaration matches. Declaring one signature
per
field count does match, but that hardcodes the widest struct we support
in a YAML file, and an OTel span's `attributes` already has 55
sub-fields.
Signed-off-by: Marc Handalian <marc.handalian@gmail.com>
Description
You couldn't query an object field directly, for example, (
fields city,stats ... by city). The schema flattened objects into dotted leaf columns and never added the parent, socitywasn't a column at all.Add the object back as a ROW column, then rewrite each scan to read only the leaves and rebuild the object above it in a project, using a new
make_structcall. The struct column can't stay in the scan: objects have no physical storage, so FieldStorageResolver rejects it with "Field [city] not found in field storage". Sub-objects get their own nestedmake_struct.To get
make_structover to DataFusion we build the Substrait call ourselves instead of letting isthmus match it against a declared signature. Isthmus wants every argument of a variadic function to be the same type, but ours alternate between a string field name and a value of any type, so no variadic declaration matches. Declaring one signature perfield count does match, but that hardcodes the widest struct we support in a YAML file, and an OTel span's
attributesalready has 55 sub-fields.Related Issues
Resolves #[Issue number to be closed when this PR is merged]
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.