fix parallel aggregate on non english locales
We generate CSV files with comma as separator. When we write times with milli seconds, then we use floating point numbers. Depending on the locale those floating point numbers may be written with comma instead of point. If that happens, then the plots are messed up. Fixed by enforcing the locale when formatting floats.
This commit is contained in:
@@ -8,6 +8,7 @@ import java.io.OutputStreamWriter;
|
||||
import java.io.Writer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -87,7 +88,7 @@ public class ParallelRequestsAggregator implements CustomAggregator {
|
||||
}
|
||||
|
||||
private void appendTimeAndValue(final StringBuilder builder, final long timeEpochMilli, final int value) {
|
||||
builder.append(String.format("%.3f", timeEpochMilli / 1000.0));
|
||||
builder.append(String.format(Locale.US, "%.3f", timeEpochMilli / 1000.0));
|
||||
builder.append(SEPARATOR);
|
||||
builder.append(value);
|
||||
builder.append(NEWLINE);
|
||||
|
||||
@@ -8,6 +8,7 @@ import java.io.OutputStreamWriter;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Formatter;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.lucares.collections.Sparse2DLongArray;
|
||||
@@ -75,7 +76,7 @@ public class ScatterAggregator implements CustomAggregator {
|
||||
|
||||
if (useMillis) {
|
||||
formattedDateBuilder.delete(0, formattedDateBuilder.length());
|
||||
formatter.format("%.3f", epochMilli / 1000.0);
|
||||
formatter.format(Locale.US, "%.3f", epochMilli / 1000.0);
|
||||
formattedDate = formattedDateBuilder.toString();
|
||||
} else {
|
||||
formattedDate = String.valueOf(epochMilli / 1000);
|
||||
|
||||
Reference in New Issue
Block a user