implement struct column assignment and validation logic#2964
Open
guancioul wants to merge 4 commits into
Open
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2964 +/- ##
==========================================
+ Coverage 85.92% 85.93% +0.01%
==========================================
Files 725 725
Lines 275605 276347 +742
==========================================
+ Hits 236811 237487 +676
- Misses 38270 38336 +66
Partials 524 524
🚀 New features to boost your workflow:
|
b0f2244 to
a0b91e3
Compare
…ation Signed-off-by: guancioul <guancioul@gmail.com>
Signed-off-by: guancioul <guancioul@gmail.com>
a0b91e3 to
7f63bb6
Compare
…gnment Signed-off-by: guancioul <guancioul@gmail.com>
…gnment Signed-off-by: guancioul <guancioul@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Change Summary
This PR implements execution and validation logic for assigning values to nested struct fields in the OTAP columnar query engine, enabling queries such as:
Validation (
validate_assigninassign.rs)StructColarm to thevalidate_assigndispatchis_valid_struct_fieldto check that the target field name actually exists in the struct schemavalidate_struct_col_assign_cardinalityto enforce the OTAP 1:many hierarchy constraint (RESOURCE ==1:many==> SCOPE ==1:many==> LOG/SPAN/METRIC); e.g.set resource.schema_url = attributes["x"]is rejected because log-level data cannot be used to assign a resource-level fieldExecution (
executeinassign.rs)StructColarm to the execution dispatch to handle struct field assignmentassign_to_struct_column— handles non-null assignment to a struct field with row-level alignment between the source array and the target struct columnassign_null_struct_field— handlesnullassignment by dropping the target field from the struct in the OTAP batchDataScope Enhancement
DataScopewith a newStructFieldvariant to represent the cardinality level of a value read from a struct column field (e.g. readingresource.schema_urlproducesStructField(ResourceAttrs))resource.schema_urlas a source expression was treated asRoot(log-level) scope — the same as any plain column — so the cardinality validator could not distinguish resource-level struct field reads from log-level readsStructField, the validator can now correctly compare the cardinality level of the source expression (e.g.resource.schema_url→StructField(ResourceAttrs)) against the destination struct column (e.g. assigning toinstrumentation_scope) and reject invalid assignments accordinglyWhat issue does this PR close?
How are these changes tested?
resource.schema_url = "something")instrumentation_scope.dropped_attributes_count = 42)resource.schema_url = attributes["x"])instrumentation_scope.name = resource.schema_url)instrumentation_scope.name = instrumentation_scope.attributes["name"])resource.dropped_attributes_count = "hello")nullto a struct field and verify the field is dropped from the batchinstrumentation_scope.name = substring(instrumentation_scope.name, 0, 6))Are there any user-facing changes?
Yes. Users can now write OPL/KQL queries that assign values to nested struct fields such as
resource.schema_url,instrumentation_scope.name,instrumentation_scope.version, andinstrumentation_scope.dropped_attributes_count.