-
Notifications
You must be signed in to change notification settings - Fork 190
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
Translate Plugin - Target Type implementation #2979
Translate Plugin - Target Type implementation #2979
Conversation
Signed-off-by: Vishal Boinapalli <[email protected]>
@@ -85,4 +95,30 @@ public boolean isPatternPresent(){ | |||
return regexParameterConfiguration == null || regexParameterConfiguration.getPatterns() != null; | |||
} | |||
|
|||
@AssertTrue(message = "The mapped values does not match the target type provided") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: "The mapped values do not match the target type provided"
return map.keySet().stream().allMatch(key -> checkTargetValueType(map.get(key))); | ||
} | ||
|
||
@AssertTrue(message = "The pattern values does not match the target type provided") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: same as above "does not" -> "do not"
@@ -16,6 +16,7 @@ dependencies { | |||
testImplementation project(':data-prepper-plugins:log-generator-source') | |||
testImplementation project(':data-prepper-test-common') | |||
implementation 'org.apache.commons:commons-lang3:3.12.0' | |||
testImplementation project(path: ':data-prepper-plugins:mutate-event-processors') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this testImplementation
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong dependency. I with push changes with implementation project(path: ':data-prepper-plugins:mutate-event-processors')
.
import java.util.stream.Stream; | ||
|
||
|
||
public class TranslateProcessorConfig { | ||
|
||
final TargetType TARGET_TYPE = TargetType.STRING; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Could just put this inline
private TargetType targetType = TargetType.STRING
private final LinkedHashMap<Range<Float>, Object> rangeMappings; | ||
private final Map<String, Object> individualMappings; | ||
private final Map<Pattern, Object> compiledPatterns; | ||
private final TypeConverter converter; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another option to not take a dependency on all mutate-events processors would be for us to just move the convert processor out to its own module
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will do it in the next PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this translate processor needs to be moved into mutate-event-processors
Signed-off-by: Vishal Boinapalli <[email protected]>
* Translate Plugin - Target Type implementation Signed-off-by: Vishal Boinapalli <[email protected]> * addressed review comments Signed-off-by: Vishal Boinapalli <[email protected]> --------- Signed-off-by: Vishal Boinapalli <[email protected]> Signed-off-by: Marcos Gonzalez Mayedo <[email protected]>
Description
Implemented target_type option in translate processor. Added necessary test cases.
Issues Resolved
#1914
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.