-
Notifications
You must be signed in to change notification settings - Fork 88
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
[#764] added ChangeLabel and ChangePropertyKeys UDFs #772
Conversation
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.
It would be nice to have at least one unit test per transformation function, for usage/documentation purposes as well as for the test coverage.
@Override | ||
public EPGMElement apply(EPGMElement current, EPGMElement transformed) { | ||
|
||
for (Map.Entry<String, String> mapping : keyMappings.entrySet()) { |
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.
TransformBase
does not set the properties in the EPGMElement transformed
, which means, that this transformation will only set the changed properties, everything else will be lost. We need to copy all non-transformed properties as well or transform and return current
instead of transformed
.
public EPGMElement apply(EPGMElement current, EPGMElement transformed) { | ||
|
||
if (current.getLabel().equals(oldLabel)) { | ||
transformed.setLabel(newLabel); |
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.
transformed
does not contain any properties. I suggest to change and return current
instead.
… and ChangeLabel UDFs
Oh ok, thanks for the advice. I got the comment stating its a "copy" wrong. |
Again an unstable foodbroker test? |
I just merged the PR to fix the flaky test. Try a rebuild pls |
@merando told me, that the UDFs in this PR don't yet work as intended. Could you please remove this "NOT READY FOR MERGE" label as soon as you are satisfied with the functionality? |
ok, it works now. I just forgot to add type information |
What do you think about renaming the two functions to |
Sounds good to me. I'll provide the commit right away |
…leipzig#772) [dbs-leipzig#764] add ChangeLabel and ChangePropertyKeys UDFs
two simple UDFs for changing a specified label and another one for changing property keys.