Search in sources :

Example 1 with ParserInfo

use of water.parser.ParserInfo 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;
}
Also used : ParseSetup(water.parser.ParseSetup) ParserInfo(water.parser.ParserInfo) ParserProvider(water.parser.ParserProvider) H2OIllegalValueException(water.exceptions.H2OIllegalValueException)

Example 2 with ParserInfo

use of water.parser.ParserInfo in project h2o-3 by h2oai.

the class ParseHandler method parse.

// Entry point for parsing.
// called through reflection by RequestServer
@SuppressWarnings("unused")
public ParseV3 parse(int version, ParseV3 parse) {
    ParserInfo parserInfo = ParserService.INSTANCE.getByName(parse.parse_type).info();
    ParseSetup setup = new ParseSetup(parserInfo, parse.separator, parse.single_quotes, parse.check_header, parse.number_columns, delNulls(parse.column_names), ParseSetup.strToColumnTypes(parse.column_types), parse.domains, parse.na_strings, null, new ParseWriter.ParseErr[0], parse.chunk_size);
    if (parse.source_frames == null)
        throw new H2OIllegalArgumentException("Data for Frame '" + parse.destination_frame.name + "' is not available. Please check that the path is valid (for all H2O nodes).'");
    Key[] srcs = new Key[parse.source_frames.length];
    for (int i = 0; i < parse.source_frames.length; i++) srcs[i] = parse.source_frames[i].key();
    parse.job = new JobV3(ParseDataset.parse(parse.destination_frame.key(), srcs, parse.delete_on_done, setup, parse.blocking)._job);
    if (parse.blocking) {
        Frame fr = DKV.getGet(parse.destination_frame.key());
        parse.rows = fr.numRows();
    }
    return parse;
}
Also used : Frame(water.fvec.Frame) ParseSetup(water.parser.ParseSetup) H2OIllegalArgumentException(water.exceptions.H2OIllegalArgumentException) ParseWriter(water.parser.ParseWriter) ParserInfo(water.parser.ParserInfo) JobV3(water.api.schemas3.JobV3) Key(water.Key)

Aggregations

ParseSetup (water.parser.ParseSetup)2 ParserInfo (water.parser.ParserInfo)2 Key (water.Key)1 JobV3 (water.api.schemas3.JobV3)1 H2OIllegalArgumentException (water.exceptions.H2OIllegalArgumentException)1 H2OIllegalValueException (water.exceptions.H2OIllegalValueException)1 Frame (water.fvec.Frame)1 ParseWriter (water.parser.ParseWriter)1 ParserProvider (water.parser.ParserProvider)1