Search in sources :

Example 1 with DeltaGenerator

use of org.apache.hudi.integ.testsuite.generator.DeltaGenerator in project hudi by apache.

the class WriterContext method initContext.

public void initContext(JavaSparkContext jsc) throws HoodieException {
    try {
        this.schemaProvider = UtilHelpers.createSchemaProvider(cfg.schemaProviderClassName, props, jsc);
        String schemaStr = schemaProvider.getSourceSchema().toString();
        this.hoodieTestSuiteWriter = new HoodieTestSuiteWriter(jsc, props, cfg, schemaStr);
        int inputParallelism = cfg.inputParallelism > 0 ? cfg.inputParallelism : jsc.defaultParallelism();
        this.deltaGenerator = new DeltaGenerator(new DFSDeltaConfig(DeltaOutputMode.valueOf(cfg.outputTypeName), DeltaInputType.valueOf(cfg.inputFormatName), new SerializableConfiguration(jsc.hadoopConfiguration()), cfg.inputBasePath, cfg.targetBasePath, schemaStr, cfg.limitFileSize, inputParallelism, cfg.deleteOldInput), jsc, sparkSession, schemaStr, keyGenerator);
        log.info(String.format("Initialized writerContext with: %s", schemaStr));
    } catch (Exception e) {
        throw new HoodieException("Failed to reinitialize writerContext", e);
    }
}
Also used : HoodieTestSuiteWriter(org.apache.hudi.integ.testsuite.HoodieTestSuiteWriter) DeltaGenerator(org.apache.hudi.integ.testsuite.generator.DeltaGenerator) SerializableConfiguration(org.apache.hudi.common.config.SerializableConfiguration) HoodieException(org.apache.hudi.exception.HoodieException) DFSDeltaConfig(org.apache.hudi.integ.testsuite.configuration.DFSDeltaConfig) HoodieException(org.apache.hudi.exception.HoodieException)

Aggregations

SerializableConfiguration (org.apache.hudi.common.config.SerializableConfiguration)1 HoodieException (org.apache.hudi.exception.HoodieException)1 HoodieTestSuiteWriter (org.apache.hudi.integ.testsuite.HoodieTestSuiteWriter)1 DFSDeltaConfig (org.apache.hudi.integ.testsuite.configuration.DFSDeltaConfig)1 DeltaGenerator (org.apache.hudi.integ.testsuite.generator.DeltaGenerator)1