use of com.baidu.hugegraph.loader.exception.LoadException 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.LoadException in project incubator-hugegraph-toolchain by apache.
the class OrcFileLineFetcher method openReader.
@Override
public void openReader(Readable readable) {
Path path = readable.path();
try {
OrcFile.ReaderOptions options = OrcFile.readerOptions(this.conf);
this.reader = OrcFile.createReader(path, options);
this.recordReader = this.reader.rows();
this.inspector = (StructObjectInspector) this.reader.getObjectInspector();
this.row = null;
} catch (IOException e) {
throw new LoadException("Failed to open orc reader for '%s'", e, readable);
}
this.resetOffset();
}
use of com.baidu.hugegraph.loader.exception.LoadException in project incubator-hugegraph-toolchain by apache.
the class HDFSFileReader method scanReadables.
@Override
protected List<Readable> scanReadables() throws IOException {
Path path = new Path(this.source().path());
FileFilter filter = this.source().filter();
List<Readable> paths = new ArrayList<>();
if (this.hdfs.isFile(path)) {
if (!filter.reserved(path.getName())) {
throw new LoadException("Please check path name and extensions, ensure " + "that at least one path is available for reading");
}
paths.add(new HDFSFile(this.hdfs, path));
} else {
assert this.hdfs.isDirectory(path);
FileStatus[] statuses = this.hdfs.listStatus(path);
Path[] subPaths = FileUtil.stat2Paths(statuses);
for (Path subPath : subPaths) {
if (filter.reserved(subPath.getName())) {
paths.add(new HDFSFile(this.hdfs, subPath));
}
}
}
return paths;
}
use of com.baidu.hugegraph.loader.exception.LoadException in project incubator-hugegraph-toolchain by apache.
the class FailWriter method write.
public void write(InsertException e) {
try {
this.writeLine("#### INSERT ERROR: " + e.getMessage());
this.writeLine(e.line());
} catch (IOException ex) {
throw new LoadException("Failed to write insert error '%s'", ex, e.line());
}
}
use of com.baidu.hugegraph.loader.exception.LoadException in project incubator-hugegraph-toolchain by apache.
the class FailWriter method write.
public void write(ParseException e) {
try {
this.writeLine("#### PARSE ERROR: " + e.getMessage());
this.writeLine(e.line());
} catch (IOException ex) {
throw new LoadException("Failed to write parse error '%s'", ex, e.line());
}
}
Aggregations