[
https://issues.apache.org/jira/browse/BEAM-12755?focusedWorklogId=638357&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-638357
]
ASF GitHub Bot logged work on BEAM-12755:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 16/Aug/21 19:12
Start Date: 16/Aug/21 19:12
Worklog Time Spent: 10m
Work Description: ajamato commented on a change in pull request #15329:
URL: https://github.com/apache/beam/pull/15329#discussion_r688682516
##########
File path:
sdks/java/core/src/main/java/org/apache/beam/sdk/util/HistogramData.java
##########
@@ -196,7 +189,7 @@ public double p50() {
private synchronized double getLinearInterpolation(double percentile) {
long totalNumOfRecords = getTotalCount();
if (totalNumOfRecords == 0) {
Review comment:
Maybe this code shouldn't ever be called if totalNumOfRecords == 0
This feature is only used to print some info logging.
So ti could just print something else in this case
WDYT @ihji ?
##########
File path:
sdks/java/core/src/main/java/org/apache/beam/sdk/util/HistogramData.java
##########
@@ -196,7 +189,7 @@ public double p50() {
private synchronized double getLinearInterpolation(double percentile) {
long totalNumOfRecords = getTotalCount();
if (totalNumOfRecords == 0) {
- throw new RuntimeException("histogram has no record.");
Review comment:
Just curious. Did you decide to make this change because you saw this
exception thrown in a user pipeline? (Its possible the code is designed to not
invoke this method in this case). Just wondering if actual pipelines are
hitting this?
Or did you just decide to make this change to make to remove the exception,
make the code safer, etc.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 638357)
Time Spent: 50m (was: 40m)
> Clean-up HistogramData to not throw errors during formatting
> ------------------------------------------------------------
>
> Key: BEAM-12755
> URL: https://issues.apache.org/jira/browse/BEAM-12755
> Project: Beam
> Issue Type: Improvement
> Components: sdk-java-core
> Reporter: Luke Cwik
> Assignee: Luke Cwik
> Priority: P3
> Time Spent: 50m
> Remaining Estimate: 0h
>
> HistogramData throws an exception because DoubleMath.roundToInt throws an
> arithmetic exception when infinity is used.
> Instead use String.format with %.0f formatting since it will appropriately
> format Inf, -Inf and NaN. It already used HALF_UP rounding as well as per the
> javadoc.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)