From 43ef88f3e5e7a4ab14fa5840a81ec26721dec247 Mon Sep 17 00:00:00 2001 From: phact Date: Thu, 1 Apr 2021 03:33:09 -0400 Subject: [PATCH] Use CSVFormat.Default to handle rfc4180 CSVs --- .github/workflows/release.yml | 1 + nb-api/src/main/java/io/nosqlbench/nb/api/content/NBIO.java | 2 +- .../basics/shared/distributions/WeightedStringsFromCSV.java | 4 +++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 90fc6ef8e..bd98a5afa 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -162,6 +162,7 @@ jobs: run: scripts/release-perform.sh continue-on-error: true env: + RELEASE_BRANCH_PATTERN: "release" RELEASE_BRANCH_NAME: "main" GIT_RELEASE_BOT_NAME: "nb-droid" GIT_RELEASE_BOT_EMAIL: ${{ secrets.GIT_RELEASE_BOT_EMAIL }} diff --git a/nb-api/src/main/java/io/nosqlbench/nb/api/content/NBIO.java b/nb-api/src/main/java/io/nosqlbench/nb/api/content/NBIO.java index 0d4579a6a..13ceffeb9 100644 --- a/nb-api/src/main/java/io/nosqlbench/nb/api/content/NBIO.java +++ b/nb-api/src/main/java/io/nosqlbench/nb/api/content/NBIO.java @@ -65,7 +65,7 @@ public class NBIO implements NBPathsAPI.Facets { public static CSVParser readFileDelimCSV(String filename,char delim, String... searchPaths) { Reader reader = NBIO.readReader(filename, searchPaths); - CSVFormat format = CSVFormat.newFormat(delim).withFirstRecordAsHeader(); + CSVFormat format = CSVFormat.DEFAULT.withDelimiter(delim).withFirstRecordAsHeader(); try { CSVParser parser = new CSVParser(reader, format); return parser; diff --git a/virtdata-lib-basics/src/main/java/io/nosqlbench/virtdata/library/basics/shared/distributions/WeightedStringsFromCSV.java b/virtdata-lib-basics/src/main/java/io/nosqlbench/virtdata/library/basics/shared/distributions/WeightedStringsFromCSV.java index a29a850ef..2d36ba5b8 100644 --- a/virtdata-lib-basics/src/main/java/io/nosqlbench/virtdata/library/basics/shared/distributions/WeightedStringsFromCSV.java +++ b/virtdata-lib-basics/src/main/java/io/nosqlbench/virtdata/library/basics/shared/distributions/WeightedStringsFromCSV.java @@ -80,7 +80,9 @@ public class WeightedStringsFromCSV implements LongFunction { String value = csvdatum.get(valueColumn); values.add(value); String weight = csvdatum.get(weightColumn); - events.add(new EvProbD(values.size() - 1, Double.valueOf(weight))); + if(!weight.isEmpty()) { + events.add(new EvProbD(values.size() - 1, Double.valueOf(weight))); + } } } }