-
Notifications
You must be signed in to change notification settings - Fork 624
Migrate transforms to use Values #1205
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
Migrate transforms to use Values #1205
Conversation
801a1e6
to
940a268
Compare
/test smoke-tests |
Codecov Report
Continue to review full report at Codecov.
|
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.
LGTM
@@ -66,6 +67,11 @@ public ObjectValue getData() { | |||
return objectValue.get(path); | |||
} | |||
|
|||
public @Nullable Value getFieldProto(FieldPath path) { | |||
FieldValue fieldValue = getField(path); |
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 seems like this should go the other way: call ObjectValue.getFieldProto(path) here and then have getField above wrap the result of getFieldProto.
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.
ObjectValue.getFieldProto() does not yet exist (but it probably should).
That being said, this will go away with #1207, which will drop the FieldValue version altogether.
@@ -120,4 +121,12 @@ private long operandAsLong() { | |||
+ operand.getClass().getCanonicalName()); | |||
} | |||
} | |||
|
|||
private boolean isInteger(@Nullable Value value) { |
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.
These could be in ProtoValues along with isNumber and isArray.
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.
Done.
return DoubleValue.valueOf(sum); | ||
if (isInteger(baseValue) && operand instanceof IntegerValue) { | ||
long sum = safeIncrement(baseValue.getIntegerValue(), operandAsLong()); | ||
return Value.newBuilder().setIntegerValue(sum).build(); |
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.
Having Values
in the production code would again benefit this code, making it less verbose to do this everywhere we do it.
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.
The Value conversion is now only available in UserDataReader, which is directly called from tests. The base branch for this PR removes the Values class.
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.
LGTM
@schmidt-sebastian: The following test failed, say
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
No description provided.