use of water.exceptions.H2OIllegalValueException in project h2o-3 by h2oai.
the class ParseSetupV3 method fillImpl.
@Override
public ParseSetup fillImpl(ParseSetup impl) {
ParseSetup parseSetup = fillImpl(impl, new String[] { "parse_type" });
// Transform the field parse_type
ParserInfo pi = GUESS_INFO;
if (this.parse_type != null) {
ParserProvider pp = ParserService.INSTANCE.getByName(this.parse_type);
if (pp != null) {
pi = pp.info();
} else
throw new H2OIllegalValueException("Cannot find right parser for specified parser type!", this.parse_type);
}
parseSetup.setParseType(pi);
return parseSetup;
}
use of water.exceptions.H2OIllegalValueException in project h2o-3 by h2oai.
the class VecUtils method numericToStringVec.
/**
* Create a new {@link Vec} of string values from a numeric {@link Vec}.
*
* Currently only uses a default pretty printer. Would be better if
* it accepted a format string PUBDEV-2211
*
* @param src a numeric {@link Vec}
* @return a string {@link Vec}
*/
public static Vec numericToStringVec(Vec src) {
if (src.isCategorical() || src.isUUID())
throw new H2OIllegalValueException("Cannot convert a non-numeric column" + " using numericToStringVec() ", src);
Vec res = new MRTask() {
@Override
public void map(Chunk chk, NewChunk newChk) {
if (chk instanceof C0DChunk) {
// all NAs
for (int i = 0; i < chk._len; i++) newChk.addNA();
} else {
for (int i = 0; i < chk._len; i++) {
if (!chk.isNA(i))
newChk.addStr(PrettyPrint.number(chk, chk.atd(i), 4));
else
newChk.addNA();
}
}
}
}.doAll(Vec.T_STR, src).outputFrame().anyVec();
assert res != null;
return res;
}
Aggregations