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
ISSUE-6612 FIX: parse long field in GenricJsonRecord (#6612) #6622
Conversation
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
6 similar comments
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
2 similar comments
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
return fn.asDouble(); | ||
} else if (fn.isDouble()) { | ||
return fn.asDouble(); | ||
} else if (fn.isNumber()) { |
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 the integration tests failed due to this change.
I think we should keep the original behavior and add the following
else if (fn.isLong()) {
return fn.asLong();
} else if (fn.isNumber()) {
return fn.numberValue();
}
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.
if fn is long, then fn.aslong() should equals to fn.numberValue()。
The differences compared to the previous code are:
- If fn is BigDecimal, the new code will return BigDecimal rather than double
- If fn is BigInteger, the new code will return BigInteger rather than text
- If fn is float, the new code will return float rather than double
So i modify the code like:
} else if (fn.isBoolean()) {
return fn.asBoolean();
} else if (fn.isFloatingPointNumber()) {
return fn.asDouble();
} else if (fn.isBigInteger()) {
if (fn.canConvertToLong()) {
return fn.asLong();
} else {
return fn.asText();
}
} else if (fn.isNumber()) {
return fn.numberValue();
} else {
return fn.asText();
}
I am trying to do integration tests locally but it takes too long to download snapshot jars from maven. I'll try again, and if fail again, can I push directly and do ci test?
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.
sounds good.
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.
Is there anything wrong with CI workflow? I reset to commit the one before the first commit of this PR, and it still fails.
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 found this pull #6660, and it has been merged.
I should try again.
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.
Finally pass the CI
/pulsarbot run-failure-checks |
1 similar comment
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
4 similar comments
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
f9f57f0
to
26cd98e
Compare
/pulsarbot run-failure-checks |
2 similar comments
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
03b803d
to
d4ee5a6
Compare
/pulsarbot run-failure-checks |
1 similar comment
/pulsarbot run-failure-checks |
d4ee5a6
to
6905380
Compare
/pulsarbot run-failure-checks |
2 similar comments
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
…pache#6622) Fixes apache#6612 ### Motivation If message sent in json schema, long field will be decoded as int if its value below Integer.MAX_VALUE, other wise decoded as string. For example, the json message below: ```json { "timestamp": 1585204833128 } ``` will be decoded as ```json { "timestamp": "1585204833128" } ``` ### Modifications Add field type check in GenericJsonRecord
Fixes #6612 ### Motivation If message sent in json schema, long field will be decoded as int if its value below Integer.MAX_VALUE, other wise decoded as string. For example, the json message below: ```json { "timestamp": 1585204833128 } ``` will be decoded as ```json { "timestamp": "1585204833128" } ``` ### Modifications Add field type check in GenericJsonRecord (cherry picked from commit 1aad3b7)
…pache#6622) Fixes apache#6612 ### Motivation If message sent in json schema, long field will be decoded as int if its value below Integer.MAX_VALUE, other wise decoded as string. For example, the json message below: ```json { "timestamp": 1585204833128 } ``` will be decoded as ```json { "timestamp": "1585204833128" } ``` ### Modifications Add field type check in GenericJsonRecord
Fixes #6612
Motivation
If message sent in json schema, long field will be decoded as int if its value below Integer.MAX_VALUE, other wise decoded as string.
For example, the json message below:
will be decoded as
Modifications
Add field type check in GenericJsonRecord
Verifying this change
Does this pull request potentially affect one of the following parts:
Documentation