use of com.baidu.hugegraph.loader.exception.InitException in project incubator-hugegraph-toolchain by apache.
the class FileReader method init.
@Override
public void init(LoadContext context, InputStruct struct) throws InitException {
this.progress(context, struct);
List<Readable> readableList;
try {
readableList = this.scanReadables();
// Sort readable files by name
readableList.sort(Comparator.comparing(Readable::name));
} catch (IOException e) {
throw new InitException("Failed to scan readable files for '%s'", e, this.source);
}
this.readables = readableList.iterator();
this.fetcher = this.createLineFetcher();
this.fetcher.readHeaderIfNeeded(readableList);
}
use of com.baidu.hugegraph.loader.exception.InitException 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);
}
}
}
use of com.baidu.hugegraph.loader.exception.InitException in project incubator-hugegraph-toolchain by apache.
the class JDBCReader method init.
@Override
public void init(LoadContext context, InputStruct struct) throws InitException {
this.progress(context, struct);
if (!this.source.existsCustomSQL()) {
try {
this.source.header(this.fetcher.readHeader());
this.fetcher.readPrimaryKey();
} catch (SQLException e) {
throw new InitException("Failed to fetch table structure info", e);
}
}
}
Aggregations