mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2024-12-22 23:23:56 -06:00
minor optimizations and corrections
This commit is contained in:
parent
17b7dbdaa4
commit
93d9dc5914
@ -18,16 +18,12 @@ package io.nosqlbench.datamappers.functions.hdf_to_cql;
|
||||
|
||||
public interface DatasetParser {
|
||||
static DatasetParser parserFactory(String parsername) {
|
||||
switch(parsername) {
|
||||
case "default":
|
||||
return new DefaultDatasetParser();
|
||||
case "noop":
|
||||
return new NoopDatasetParser();
|
||||
case "jaw":
|
||||
return new JAWDatasetParser();
|
||||
default:
|
||||
throw new RuntimeException("Unknown parser name: " + parsername);
|
||||
}
|
||||
return switch (parsername) {
|
||||
case "default" -> new DefaultDatasetParser();
|
||||
case "noop" -> new NoopDatasetParser();
|
||||
case "jaw" -> new JAWDatasetParser();
|
||||
default -> throw new RuntimeException("Unknown parser name: " + parsername);
|
||||
};
|
||||
}
|
||||
|
||||
String parse(String raw);
|
||||
|
@ -20,7 +20,7 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
public class DefaultDatasetPerserTest {
|
||||
public class DefaultDatasetParserTest {
|
||||
String test1 = "{\"conditions\": {\"and\": [{\"a\": {\"match\": {\"value\": 53}}}]}}";
|
||||
String test2 = "{\"conditions\": {\"and\": [{\"a\": {\"match\": {\"value\": \"thirteen\"}}}, {\"b\": {\"match\": {\"value\": \"fifty-four\"}}}]}}";
|
||||
String test3 = "{\"conditions\": {\"and\": [{\"a\": {\"match\": {\"value\": 13}}}, {\"b\": {\"match\": {\"value\": 54}}}, {\"a\": {\"match\": {\"value\": 154}}}]}}";
|
@ -43,9 +43,7 @@ public class HdfDatasetToStrings extends AbstractHdfFileToVectorType implements
|
||||
int[] sliceDimensions = new int[dims.length];
|
||||
sliceDimensions[0] = 1;
|
||||
if (dims.length > 1) {
|
||||
for (int i = 1; i < dims.length; i++) {
|
||||
sliceDimensions[i] = dims[i];
|
||||
}
|
||||
System.arraycopy(dims, 1, sliceDimensions, 1, dims.length - 1);
|
||||
}
|
||||
String payload = null;
|
||||
switch(dataset.getJavaType().getSimpleName().toLowerCase()) {
|
||||
@ -67,7 +65,7 @@ public class HdfDatasetToStrings extends AbstractHdfFileToVectorType implements
|
||||
if (payload == null) {
|
||||
throw new RuntimeException("Unsupported datatype: " + dataset.getJavaType().getSimpleName());
|
||||
}
|
||||
payload = payload.replaceAll("\\[", "").replaceAll("\\]", "");
|
||||
payload = payload.replaceAll("\\[", "").replaceAll("]", "");
|
||||
return payload;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user