Search in sources :

Example 1 with BadRecordsLogger

use of org.apache.carbondata.processing.surrogatekeysgenerator.csvbased.BadRecordsLogger in project carbondata by apache.

the class DataConverterProcessorStepImpl method createBadRecordLogger.

private BadRecordsLogger createBadRecordLogger() {
    boolean badRecordsLogRedirect = false;
    boolean badRecordConvertNullDisable = false;
    boolean isDataLoadFail = false;
    boolean badRecordsLoggerEnable = Boolean.parseBoolean(configuration.getDataLoadProperty(DataLoadProcessorConstants.BAD_RECORDS_LOGGER_ENABLE).toString());
    Object bad_records_action = configuration.getDataLoadProperty(DataLoadProcessorConstants.BAD_RECORDS_LOGGER_ACTION).toString();
    if (null != bad_records_action) {
        LoggerAction loggerAction = null;
        try {
            loggerAction = LoggerAction.valueOf(bad_records_action.toString().toUpperCase());
        } catch (IllegalArgumentException e) {
            loggerAction = LoggerAction.FORCE;
        }
        switch(loggerAction) {
            case FORCE:
                badRecordConvertNullDisable = false;
                break;
            case REDIRECT:
                badRecordsLogRedirect = true;
                badRecordConvertNullDisable = true;
                break;
            case IGNORE:
                badRecordsLogRedirect = false;
                badRecordConvertNullDisable = true;
                break;
            case FAIL:
                isDataLoadFail = true;
                break;
        }
    }
    CarbonTableIdentifier identifier = configuration.getTableIdentifier().getCarbonTableIdentifier();
    return new BadRecordsLogger(identifier.getBadRecordLoggerKey(), identifier.getTableName() + '_' + System.currentTimeMillis(), getBadLogStoreLocation(identifier.getDatabaseName() + CarbonCommonConstants.FILE_SEPARATOR + identifier.getTableName() + CarbonCommonConstants.FILE_SEPARATOR + configuration.getSegmentId() + CarbonCommonConstants.FILE_SEPARATOR + configuration.getTaskNo()), badRecordsLogRedirect, badRecordsLoggerEnable, badRecordConvertNullDisable, isDataLoadFail);
}
Also used : CarbonTableIdentifier(org.apache.carbondata.core.metadata.CarbonTableIdentifier) LoggerAction(org.apache.carbondata.processing.constants.LoggerAction) BadRecordsLogger(org.apache.carbondata.processing.surrogatekeysgenerator.csvbased.BadRecordsLogger)

Example 2 with BadRecordsLogger

use of org.apache.carbondata.processing.surrogatekeysgenerator.csvbased.BadRecordsLogger in project carbondata by apache.

the class DataConverterProcessorWithBucketingStepImpl method createBadRecordLogger.

private BadRecordsLogger createBadRecordLogger() {
    boolean badRecordsLogRedirect = false;
    boolean badRecordConvertNullDisable = false;
    boolean isDataLoadFail = false;
    boolean badRecordsLoggerEnable = Boolean.parseBoolean(configuration.getDataLoadProperty(DataLoadProcessorConstants.BAD_RECORDS_LOGGER_ENABLE).toString());
    Object bad_records_action = configuration.getDataLoadProperty(DataLoadProcessorConstants.BAD_RECORDS_LOGGER_ACTION).toString();
    if (null != bad_records_action) {
        LoggerAction loggerAction = null;
        try {
            loggerAction = LoggerAction.valueOf(bad_records_action.toString().toUpperCase());
        } catch (IllegalArgumentException e) {
            loggerAction = LoggerAction.FORCE;
        }
        switch(loggerAction) {
            case FORCE:
                badRecordConvertNullDisable = false;
                break;
            case REDIRECT:
                badRecordsLogRedirect = true;
                badRecordConvertNullDisable = true;
                break;
            case IGNORE:
                badRecordsLogRedirect = false;
                badRecordConvertNullDisable = true;
                break;
            case FAIL:
                isDataLoadFail = true;
                break;
        }
    }
    CarbonTableIdentifier identifier = configuration.getTableIdentifier().getCarbonTableIdentifier();
    return new BadRecordsLogger(identifier.getBadRecordLoggerKey(), identifier.getTableName() + '_' + System.currentTimeMillis(), getBadLogStoreLocation(identifier.getDatabaseName() + CarbonCommonConstants.FILE_SEPARATOR + identifier.getTableName() + CarbonCommonConstants.FILE_SEPARATOR + configuration.getSegmentId() + CarbonCommonConstants.FILE_SEPARATOR + configuration.getTaskNo()), badRecordsLogRedirect, badRecordsLoggerEnable, badRecordConvertNullDisable, isDataLoadFail);
}
Also used : CarbonTableIdentifier(org.apache.carbondata.core.metadata.CarbonTableIdentifier) LoggerAction(org.apache.carbondata.processing.constants.LoggerAction) BadRecordsLogger(org.apache.carbondata.processing.surrogatekeysgenerator.csvbased.BadRecordsLogger)

Aggregations

CarbonTableIdentifier (org.apache.carbondata.core.metadata.CarbonTableIdentifier)2 LoggerAction (org.apache.carbondata.processing.constants.LoggerAction)2 BadRecordsLogger (org.apache.carbondata.processing.surrogatekeysgenerator.csvbased.BadRecordsLogger)2