mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2024-12-27 17:21:08 -06:00
CSVRecord null checks
This commit is contained in:
parent
a4b2a63957
commit
de9075df93
@ -52,7 +52,9 @@ public class ModuloCSVLineToUUID implements LongFunction<UUID> {
|
||||
CSVParser csvp = NBIO.readFileCSV(filename);
|
||||
int column = csvp.getHeaderMap().get(fieldname);
|
||||
for (CSVRecord strings : csvp) {
|
||||
lines.add(strings.get(column));
|
||||
if (strings.get(column) != null) {
|
||||
lines.add(strings.get(column));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -78,9 +78,11 @@ public class CSVFrequencySampler implements LongFunction<String> {
|
||||
CSVParser csvdata = NBIO.readFileCSV(filename);
|
||||
Frequency freq = new Frequency();
|
||||
for (CSVRecord csvdatum : csvdata) {
|
||||
String value = csvdatum.get(columnName);
|
||||
freq.addValue(value);
|
||||
values.add(value);
|
||||
if (csvdatum.get(columnName) != null) {
|
||||
String value = csvdatum.get(columnName);
|
||||
freq.addValue(value);
|
||||
values.add(value);
|
||||
}
|
||||
}
|
||||
int i = 0;
|
||||
for (String value : values) {
|
||||
|
@ -81,9 +81,11 @@ public class DelimFrequencySampler implements LongFunction<String> {
|
||||
CSVParser csvdata = NBIO.readFileDelimCSV(filename,delimiter);
|
||||
Frequency freq = new Frequency();
|
||||
for (CSVRecord csvdatum : csvdata) {
|
||||
String value = csvdatum.get(columnName);
|
||||
freq.addValue(value);
|
||||
values.add(value);
|
||||
if (csvdatum.get(columnName) != null) {
|
||||
String value = csvdatum.get(columnName);
|
||||
freq.addValue(value);
|
||||
values.add(value);
|
||||
}
|
||||
}
|
||||
int i = 0;
|
||||
for (String value : values) {
|
||||
|
@ -76,10 +76,12 @@ public class WeightedStringsFromCSV implements LongFunction<String> {
|
||||
}
|
||||
CSVParser csvdata = NBIO.readFileCSV(filename);
|
||||
for (CSVRecord csvdatum : csvdata) {
|
||||
String value = csvdatum.get(valueColumn);
|
||||
values.add(value);
|
||||
String weight = csvdatum.get(weightColumn);
|
||||
events.add(new EvProbD(values.size()-1,Double.valueOf(weight)));
|
||||
if (csvdatum.get(valueColumn) != null && csvdatum.get(weightColumn) != null) {
|
||||
String value = csvdatum.get(valueColumn);
|
||||
values.add(value);
|
||||
String weight = csvdatum.get(weightColumn);
|
||||
events.add(new EvProbD(values.size() - 1, Double.valueOf(weight)));
|
||||
}
|
||||
}
|
||||
}
|
||||
sampler = new AliasSamplerDoubleInt(events);
|
||||
|
@ -60,7 +60,9 @@ public class ModuloCSVLineToString implements LongFunction<String> {
|
||||
}
|
||||
|
||||
for (CSVRecord strings : csvp) {
|
||||
lines.add(strings.get(column));
|
||||
if (strings.get(column) != null) {
|
||||
lines.add(strings.get(column));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -240,4 +240,3 @@ EH,Western Sahara
|
||||
YE,Yemen
|
||||
ZM,Zambia
|
||||
ZW,Zimbabwe
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user