Search in sources :

Example 1 with InputReader

use of com.baidu.hugegraph.loader.reader.InputReader in project incubator-hugegraph-toolchain by apache.

the class HugeGraphLoader method loadStructs.

private void loadStructs(List<InputStruct> structs) {
    // Load input structs one by one
    for (InputStruct struct : structs) {
        if (this.context.stopped()) {
            break;
        }
        if (struct.skip()) {
            continue;
        }
        // Create and init InputReader, fetch next batch lines
        try (InputReader reader = InputReader.create(struct.input())) {
            // Init reader
            reader.init(this.context, struct);
            // Load data from current input mapping
            this.loadStruct(struct, reader);
        } catch (InitException e) {
            throw new LoadException("Failed to init input reader", e);
        }
    }
}
Also used : InputReader(com.baidu.hugegraph.loader.reader.InputReader) InputStruct(com.baidu.hugegraph.loader.mapping.InputStruct) InitException(com.baidu.hugegraph.loader.exception.InitException) LoadException(com.baidu.hugegraph.loader.exception.LoadException)

Aggregations

InitException (com.baidu.hugegraph.loader.exception.InitException)1 LoadException (com.baidu.hugegraph.loader.exception.LoadException)1 InputStruct (com.baidu.hugegraph.loader.mapping.InputStruct)1 InputReader (com.baidu.hugegraph.loader.reader.InputReader)1