[Tables] UDT partial projection and schema projection #2228
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Implements UDT partial projection with precise schema reflection, and adds comprehensive unit + integration tests for both non-UDT and UDT projections (inclusion, exclusion, null handling).
UDT Partial Projection & Schema
Use dot notation for UDT subfields (e.g.,
{"mainAddress.city": 1}).{ "mainAddress": 1 }: schema includes all UDT fields (city,country).{ "mainAddress.city": 1 }: schema includes onlycityunderdefinition.fields.{ "mainAddress": 1, "mainAddress.city": 1 }: all UDT fields present.{ "mainAddress.city": 0 }: schema lists only remaining fields (e.g.,country).Projection schema mirrors exactly the selected (or remaining after exclusion) UDT fields under
status.projectionSchema.<udtColumn>.definition.fields.Testing
JSON Examples
Exclude a UDT subfield
{ "mainAddress.city": 0 }{ "data": { "document": { "id": "mike", "mainAddress": { "country": "USA" } } }, "status": { "projectionSchema": { "id": { "type": "text" }, "mainAddress": { "type": "userDefined", "udtName": "address", "definition": { "fields": { "country": { "type": "text" } } } } } } }Include only a UDT subfield
{ "mainAddress.city": 1 }{ "status": { "projectionSchema": { "mainAddress": { "type": "userDefined", "udtName": "address", "definition": { "fields": { "city": { "type": "text" } } } } } } }Include UDT top-level
{ "mainAddress": 1 }{ "status": { "projectionSchema": { "mainAddress": { "type": "userDefined", "udtName": "address", "definition": { "fields": { "city": { "type": "text" }, "country": { "type": "text" } } } } } } }Checklist