-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type mappings transformation #1154
Draft
gregschohn
wants to merge
10
commits into
opensearch-project:main
Choose a base branch
from
gregschohn:TypeMappingsTransformation
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Type mappings transformation #1154
gregschohn
wants to merge
10
commits into
opensearch-project:main
from
gregschohn:TypeMappingsTransformation
+1,696
−43
Conversation
This file contains 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
…g w/ Jinjava. Major things to figure out: 1) how to deal with compositing parts of jinja templates (maybe it's just snippets vended as resources and a user writes their own top-level template) and 2) how to suppress reading any part of the json body when only the headers need to be transformed to prevent parsing the json/ndjson for every request through the system (probably minor though since most setups will probably be doing full-transforms on the vast majority of data flowing). Signed-off-by: Greg Schohn <[email protected]>
… so that they can fit w/in the transformation ecosystems. Signed-off-by: Greg Schohn <[email protected]>
This supports preparsing templates and loading default or specific versions. Those features are likely now in flux to be replaced with a better UX. Signed-off-by: Greg Schohn <[email protected]>
…ts of jinjava transforms (see 'is_enabled'). These changes will reduce the efficiency of this type of transform, but w/out it, it isn't clear how we'll utilize dynamic typing. My hope is that template logic is small relative to documents - and compute is cheap, so these are good tradeoffs to make. Signed-off-by: Greg Schohn <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1154 +/- ##
============================================
- Coverage 80.74% 80.65% -0.09%
- Complexity 2924 3003 +79
============================================
Files 399 410 +11
Lines 14845 15293 +448
Branches 1007 1040 +33
============================================
+ Hits 11986 12335 +349
- Misses 2252 2329 +77
- Partials 607 629 +22
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
…s after the templating... That preserve splicing not only improves efficiency, it also lets us pass messages through a template that might have non-textual data, like the ByteBufs, etc. Signed-off-by: Greg Schohn <[email protected]>
Signed-off-by: Greg Schohn <[email protected]>
…macro by name and invoke it since jinjava can't deal with invoking macros with dynamic names. There are some rough tests in place that don't fully work. The original ambition was to allow a user to specify both a route and an action for a given map in a macro but since macros only output rendered content, they're not well-suited to chain complex data (like regex matches) between macros. As such, there will be significant design changes to the jinja routing mechanisms. Signed-off-by: Greg Schohn <[email protected]>
Signed-off-by: Greg Schohn <[email protected]>
gregschohn
force-pushed
the
TypeMappingsTransformation
branch
from
November 24, 2024 04:10
e68a155
to
e8dfb3f
Compare
Switched out Google's re2j for Java's implementation. I didn't realize that the java implementation is closer to python regexes and that re2j (which I had thought was closer to python). Minor tweaks to the route jinja template to make it easier to read when it's invoked. Switched the replayer template to use the route functionality, which is considerably easier to get one's head around. TODO - * I'd like to make the feature flag names the same as the macro name for the route when the feature flag name is omitted. * The test cases for the type mappings sanitization need a lot of work. * When indices are created that DO NOT use type mappings, we should handle those more gracefully. Signed-off-by: Greg Schohn <[email protected]>
gregschohn
force-pushed
the
TypeMappingsTransformation
branch
from
November 24, 2024 20:48
b1f3756
to
93dc5c8
Compare
…gexes and the target index can be specified with backreferences. Notice that there's no way to discard data with regexes like there is with the type mappings (and the static type mappings do yield to regexes when no match was found). Other changes: The regex capture filter now has a guava cache for compiled patterns. When static and regex mappings are null, we'll use a default (.*), (.*) -> \1_\2 mapping. Enhanced some tests to pick up more corner cases. Signed-off-by: Greg Schohn <[email protected]>
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.
Description
[Describe what this change achieves]
Issues Resolved
[List any issues this PR will resolve]
Is this a backport? If so, please add backport PR # and/or commits #
Testing
[Please provide details of testing done: unit testing, integration testing and manual testing]
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.