Search in sources :

Example 1 with FlexibleSchemaRecordGenerationIterator

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

the class TestDFSHoodieTestSuiteWriterAdapter method testDFSWorkloadSinkWithMultipleFilesFunctional.

@Test
public void testDFSWorkloadSinkWithMultipleFilesFunctional() throws IOException {
    DeltaConfig dfsSinkConfig = new DFSDeltaConfig(DeltaOutputMode.DFS, DeltaInputType.AVRO, new SerializableConfiguration(jsc.hadoopConfiguration()), dfsBasePath, dfsBasePath, schemaProvider.getSourceSchema().toString(), 10240L, jsc.defaultParallelism(), false);
    DeltaWriterAdapter<GenericRecord> dfsDeltaWriterAdapter = DeltaWriterFactory.getDeltaWriterAdapter(dfsSinkConfig, 1);
    FlexibleSchemaRecordGenerationIterator itr = new FlexibleSchemaRecordGenerationIterator(1000, schemaProvider.getSourceSchema().toString());
    dfsDeltaWriterAdapter.write(itr);
    FileSystem fs = FSUtils.getFs(dfsBasePath, jsc.hadoopConfiguration());
    FileStatus[] fileStatuses = fs.listStatus(new Path(dfsBasePath));
    // Since maxFileSize was 10240L and we produced 1K records each close to 1K size, we should produce more than
    // 1 file
    assertTrue(fileStatuses.length > 0);
}
Also used : Path(org.apache.hadoop.fs.Path) FileStatus(org.apache.hadoop.fs.FileStatus) SerializableConfiguration(org.apache.hudi.common.config.SerializableConfiguration) FileSystem(org.apache.hadoop.fs.FileSystem) FlexibleSchemaRecordGenerationIterator(org.apache.hudi.integ.testsuite.generator.FlexibleSchemaRecordGenerationIterator) DeltaConfig(org.apache.hudi.integ.testsuite.configuration.DeltaConfig) DFSDeltaConfig(org.apache.hudi.integ.testsuite.configuration.DFSDeltaConfig) GenericRecord(org.apache.avro.generic.GenericRecord) DFSDeltaConfig(org.apache.hudi.integ.testsuite.configuration.DFSDeltaConfig) Test(org.junit.jupiter.api.Test)

Aggregations

GenericRecord (org.apache.avro.generic.GenericRecord)1 FileStatus (org.apache.hadoop.fs.FileStatus)1 FileSystem (org.apache.hadoop.fs.FileSystem)1 Path (org.apache.hadoop.fs.Path)1 SerializableConfiguration (org.apache.hudi.common.config.SerializableConfiguration)1 DFSDeltaConfig (org.apache.hudi.integ.testsuite.configuration.DFSDeltaConfig)1 DeltaConfig (org.apache.hudi.integ.testsuite.configuration.DeltaConfig)1 FlexibleSchemaRecordGenerationIterator (org.apache.hudi.integ.testsuite.generator.FlexibleSchemaRecordGenerationIterator)1 Test (org.junit.jupiter.api.Test)1