mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
more verbose null checks
This commit is contained in:
parent
ebd0ab7a4b
commit
f6fafd1c62
@ -1,7 +1,7 @@
|
||||
package io.nosqlbench.virtdata.core.bindings;
|
||||
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@ -11,34 +11,34 @@ import java.util.regex.Pattern;
|
||||
|
||||
public class CompatibilityFixups {
|
||||
|
||||
private final static Logger logger = LogManager.getLogger(CompatibilityFixups.class);
|
||||
private final static Logger logger = LogManager.getLogger(CompatibilityFixups.class);
|
||||
|
||||
// Not all of these are simple upper-case changes
|
||||
private final static Map<String,String> funcs = new HashMap<String,String>() {{
|
||||
put("log_normal","LogNormal");
|
||||
private final static Map<String, String> funcs = new HashMap<String, String>() {{
|
||||
put("log_normal", "LogNormal");
|
||||
put("normal", "Normal");
|
||||
put("levy", "Levy");
|
||||
put("nakagami","Nakagami");
|
||||
put("exponential","Exponential");
|
||||
put("logistic","Logistic");
|
||||
put("laplace","Laplace");
|
||||
put("cauchy","Cauchy");
|
||||
put("f","F");
|
||||
put("t","T");
|
||||
put("weibull","Weibull");
|
||||
put("chi_squared","ChiSquared");
|
||||
put("gumbel","Gumbel");
|
||||
put("beta","Beta");
|
||||
put("pareto","Pareto");
|
||||
put("gamma","Gamma");
|
||||
put("uniform_real","Uniform");
|
||||
put("uniform_integer","Uniform");
|
||||
put("hypergeometric","Hypergeometric");
|
||||
put("geometric","Geometric");
|
||||
put("poisson","Poisson");
|
||||
put("zipf","Zipf");
|
||||
put("binomial","Binomial");
|
||||
put("pascal","Pascal");
|
||||
put("nakagami", "Nakagami");
|
||||
put("exponential", "Exponential");
|
||||
put("logistic", "Logistic");
|
||||
put("laplace", "Laplace");
|
||||
put("cauchy", "Cauchy");
|
||||
put("f", "F");
|
||||
put("t", "T");
|
||||
put("weibull", "Weibull");
|
||||
put("chi_squared", "ChiSquared");
|
||||
put("gumbel", "Gumbel");
|
||||
put("beta", "Beta");
|
||||
put("pareto", "Pareto");
|
||||
put("gamma", "Gamma");
|
||||
put("uniform_real", "Uniform");
|
||||
put("uniform_integer", "Uniform");
|
||||
put("hypergeometric", "Hypergeometric");
|
||||
put("geometric", "Geometric");
|
||||
put("poisson", "Poisson");
|
||||
put("zipf", "Zipf");
|
||||
put("binomial", "Binomial");
|
||||
put("pascal", "Pascal");
|
||||
}};
|
||||
private static final String MAPTO = "mapto_";
|
||||
private static final String HASHTO = "hashto_";
|
||||
@ -58,7 +58,9 @@ public class CompatibilityFixups {
|
||||
}
|
||||
|
||||
public String fix(String spec) {
|
||||
|
||||
if (spec == null) {
|
||||
throw new RuntimeException("Unable to fixup a spec that is null");
|
||||
}
|
||||
// Fixup curve ctors. These are not HOF, so local matching will work fine. However, they could occur multiple
|
||||
// times within an HOF, so multiple replace is necessary.
|
||||
Matcher matcher = oldcurve.matcher(spec);
|
||||
@ -74,35 +76,37 @@ public class CompatibilityFixups {
|
||||
out.append(spec.substring(start));
|
||||
|
||||
return out.toString();
|
||||
|
||||
|
||||
}
|
||||
|
||||
private String fixCurveCall(String name, String args) {
|
||||
boolean map = false;
|
||||
boolean compute = false;
|
||||
if (name.contains(MAPTO)) {
|
||||
name = name.replaceAll(MAPTO,"");
|
||||
map=true;
|
||||
name = name.replaceAll(MAPTO, "");
|
||||
map = true;
|
||||
}
|
||||
if (name.contains(HASHTO)) {
|
||||
name = name.replaceAll(HASHTO,"");
|
||||
map=false;
|
||||
name = name.replaceAll(HASHTO, "");
|
||||
map = false;
|
||||
}
|
||||
if (name.contains(COMPUTE)) {
|
||||
name = name.replaceAll(COMPUTE,"");
|
||||
compute=true;
|
||||
name = name.replaceAll(COMPUTE, "");
|
||||
compute = true;
|
||||
}
|
||||
if (name.contains(INTERPOLATE)) {
|
||||
name = name.replaceAll(INTERPOLATE,"");
|
||||
compute=false;
|
||||
name = name.replaceAll(INTERPOLATE, "");
|
||||
compute = false;
|
||||
}
|
||||
|
||||
String nameReplacement = funcs.get(name);
|
||||
if (nameReplacement!=null) {
|
||||
name=nameReplacement;
|
||||
args=map?args+",'map'":args+",'hash'";
|
||||
args=compute?args+",'compute'":args+",'interpolate'";
|
||||
if (nameReplacement != null) {
|
||||
name = nameReplacement;
|
||||
args = map ? args + ",'map'" : args + ",'hash'";
|
||||
args = compute ? args + ",'compute'" : args + ",'interpolate'";
|
||||
}
|
||||
return name+"("+args+")";
|
||||
return name + "(" + args + ")";
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user