use of org.apache.carbondata.processing.newflow.exception.BadRecordFoundException in project carbondata by apache.
the class DataLoadExecutor method execute.
public void execute(CarbonLoadModel loadModel, String storeLocation, CarbonIterator<Object[]>[] inputIterators) throws Exception {
AbstractDataLoadProcessorStep loadProcessorStep = null;
try {
loadProcessorStep = new DataLoadProcessBuilder().build(loadModel, storeLocation, inputIterators);
// 1. initialize
loadProcessorStep.initialize();
LOGGER.info("Data Loading is started for table " + loadModel.getTableName());
// 2. execute the step
loadProcessorStep.execute();
} catch (CarbonDataLoadingException e) {
throw e;
} catch (Exception e) {
LOGGER.error(e, "Data Loading failed for table " + loadModel.getTableName());
throw new CarbonDataLoadingException("Data Loading failed for table " + loadModel.getTableName(), e);
} finally {
if (loadProcessorStep != null) {
// 3. Close the step
loadProcessorStep.close();
}
}
String key = new CarbonTableIdentifier(loadModel.getDatabaseName(), loadModel.getTableName(), null).getBadRecordLoggerKey();
if (null != BadRecordsLogger.hasBadRecord(key)) {
LOGGER.error("Data Load is partially success for table " + loadModel.getTableName());
throw new BadRecordFoundException("Bad records found during load");
} else {
LOGGER.info("Data loading is successful for table " + loadModel.getTableName());
}
}
Aggregations