Search in sources :

Example 11 with HoodieRecordSizeEstimator

use of org.apache.hudi.common.util.HoodieRecordSizeEstimator in project hudi by apache.

the class BufferedConnectWriter method init.

private void init() {
    try {
        // Load and batch all incoming records in a map
        long memoryForMerge = IOUtils.getMaxMemoryPerPartitionMerge(context.getTaskContextSupplier(), config);
        LOG.info("MaxMemoryPerPartitionMerge => " + memoryForMerge);
        this.bufferedRecords = new ExternalSpillableMap<>(memoryForMerge, config.getSpillableMapBasePath(), new DefaultSizeEstimator(), new HoodieRecordSizeEstimator(new Schema.Parser().parse(config.getSchema())), config.getCommonConfig().getSpillableDiskMapType(), config.getCommonConfig().isBitCaskDiskMapCompressionEnabled());
    } catch (IOException io) {
        throw new HoodieIOException("Cannot instantiate an ExternalSpillableMap", io);
    }
}
Also used : HoodieRecordSizeEstimator(org.apache.hudi.common.util.HoodieRecordSizeEstimator) HoodieIOException(org.apache.hudi.exception.HoodieIOException) IOException(java.io.IOException) HoodieIOException(org.apache.hudi.exception.HoodieIOException) DefaultSizeEstimator(org.apache.hudi.common.util.DefaultSizeEstimator)

Aggregations

HoodieRecordSizeEstimator (org.apache.hudi.common.util.HoodieRecordSizeEstimator)11 Schema (org.apache.avro.Schema)9 HoodieRecord (org.apache.hudi.common.model.HoodieRecord)9 DefaultSizeEstimator (org.apache.hudi.common.util.DefaultSizeEstimator)9 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)9 IndexedRecord (org.apache.avro.generic.IndexedRecord)7 HoodieRecordPayload (org.apache.hudi.common.model.HoodieRecordPayload)7 MethodSource (org.junit.jupiter.params.provider.MethodSource)6 IOException (java.io.IOException)5 Test (org.junit.jupiter.api.Test)4 UncheckedIOException (java.io.UncheckedIOException)3 ArrayList (java.util.ArrayList)3 GenericRecord (org.apache.avro.generic.GenericRecord)3 HoodieAvroRecord (org.apache.hudi.common.model.HoodieAvroRecord)3 HoodieKey (org.apache.hudi.common.model.HoodieKey)3 HoodieAvroPayload (org.apache.hudi.common.model.HoodieAvroPayload)2 SchemaTestUtil.getSimpleSchema (org.apache.hudi.common.testutils.SchemaTestUtil.getSimpleSchema)2 HoodieIOException (org.apache.hudi.exception.HoodieIOException)2 URISyntaxException (java.net.URISyntaxException)1 Iterator (java.util.Iterator)1