feat: support one-to-many in field_name_mapping#40
Merged
mostafa merged 1 commit intotimescale:mainfrom Apr 27, 2026
Merged
Conversation
mostafa
reviewed
Apr 26, 2026
Member
mostafa
left a comment
There was a problem hiding this comment.
Thanks for your contribution! 🙏
The only blockers to merging this PR are:
- Formatting of the code.
- Upper bound warning for the
cartesian_productfunction.
c115e1a to
71d1ccc
Compare
mostafa
approved these changes
Apr 27, 2026
Match pySigma's FieldMappingTransformation: a single source field name in `field_name_mapping` can now map to a list of alternative target field names. When more than one alternative is supplied, the matched detection item is replaced with an OR-conjunction over the alternatives. If the surrounding `AllOf` selection has other items, they're preserved across each branch via a Cartesian expansion so AND/OR semantics stay correct.
Wire-compatible at the YAML layer: existing `mapping: {a: b}` pipelines continue to parse — `parse_string_or_list_mapping` accepts both string and list values per key. `Transformation::FieldNameMapping`'s value type changes from `HashMap<String, String>` to `HashMap<String, Vec<String>>`, which is a source-level break for any direct in-Rust constructors.
Correlation rules consume only the first listed alternative for `group_by`, `aliases` mapping values, and threshold `field` — those positions are inherently scalar and OR semantics aren't expressible there. Other field-name transforms (`field_name_prefix`, `field_name_suffix`, `field_name_prefix_mapping`, `field_name_transform`) remain conceptually 1:1; they wrap their single result internally.
Tests: 3 new unit tests covering AnyOf expansion, Cartesian product when multiple items expand, and the single-alternative fast path; 2 new end-to-end YAML integration tests.
71d1ccc to
2a4eeed
Compare
Contributor
Author
|
Signed the commit now to meet your merge requirements. :) |
mostafa
approved these changes
Apr 27, 2026
4 tasks
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.
Match pySigma's FieldMappingTransformation: a single source field name in
field_name_mappingcan now map to a list of alternative target field names. When more than one alternative is supplied, the matched detection item is replaced with an OR-conjunction over the alternatives. If the surroundingAllOfselection has other items, they're preserved across each branch via a Cartesian expansion so AND/OR semantics stay correct.Wire-compatible at the YAML layer: existing
mapping: {a: b}pipelines continue to parse:parse_string_or_list_mappingaccepts both string and list values per key.Transformation::FieldNameMapping's value type changes fromHashMap<String, String>toHashMap<String, Vec<String>>, which is a source-level break for any direct in-Rust constructors.Correlation rules consume only the first listed alternative for
group_by,aliasesmapping values, and thresholdfieldas those positions are inherently scalar and OR semantics aren't expressible there. Other field-name transforms (field_name_prefix,field_name_suffix,field_name_prefix_mapping,field_name_transform) remain conceptually 1:1; they wrap their single result internally.Tests: 3 new unit tests covering AnyOf expansion, Cartesian product when multiple items expand, and the single-alternative fast path; 2 new end-to-end YAML integration tests.