1
0

[HUDI-3709] Fixing ParquetWriter impls not respecting Parquet Max File Size limit (#5129)

This commit is contained in:
Alexey Kudinkin
2022-03-26 14:51:36 -07:00
committed by GitHub
parent 57b4f39c31
commit 189d5297b8
7 changed files with 4 additions and 21 deletions

View File

@@ -37,8 +37,6 @@ public interface HoodieFileWriter<R extends IndexedRecord> {
void writeAvro(String key, R oldRecord) throws IOException;
long getBytesWritten();
default void prepRecordWithMetadata(R avroRecord, HoodieRecord record, String instantTime, Integer partitionId, AtomicLong recordIndex, String fileName) {
String seqId = HoodieRecord.generateSequenceId(instantTime, partitionId, recordIndex.getAndIncrement());
HoodieAvroUtils.addHoodieKeyToRecord((GenericRecord) avroRecord, record.getRecordKey(), record.getPartitionPath(), fileName);

View File

@@ -187,9 +187,4 @@ public class HoodieHFileWriter<T extends HoodieRecordPayload, R extends IndexedR
writer.close();
writer = null;
}
@Override
public long getBytesWritten() {
return fs.getBytesWritten(file);
}
}

View File

@@ -165,9 +165,4 @@ public class HoodieOrcWriter<T extends HoodieRecordPayload, R extends IndexedRec
writer.close();
}
@Override
public long getBytesWritten() {
return fs.getBytesWritten(file);
}
}

View File

@@ -97,7 +97,7 @@ public class HoodieParquetWriter<T extends HoodieRecordPayload, R extends Indexe
@Override
public boolean canWrite() {
return fs.getBytesWritten(file) < maxFileSize;
return getDataSize() < maxFileSize;
}
@Override
@@ -107,9 +107,4 @@ public class HoodieParquetWriter<T extends HoodieRecordPayload, R extends Indexe
writeSupport.add(key);
}
}
@Override
public long getBytesWritten() {
return fs.getBytesWritten(file);
}
}

View File

@@ -402,7 +402,7 @@ public class TestJavaCopyOnWriteActionExecutor extends HoodieJavaClientTestBase
counts++;
}
}
assertEquals(3, counts, "If the number of records are more than 1150, then there should be a new file");
assertEquals(5, counts, "If the number of records are more than 1150, then there should be a new file");
}
@Test

View File

@@ -56,7 +56,7 @@ public class HoodieInternalRowParquetWriter extends ParquetWriter<InternalRow>
@Override
public boolean canWrite() {
return fs.getBytesWritten(file) < maxFileSize;
return getDataSize() < maxFileSize;
}
@Override

View File

@@ -437,7 +437,7 @@ public class TestCopyOnWriteActionExecutor extends HoodieClientTestBase {
counts++;
}
}
assertEquals(3, counts, "If the number of records are more than 1150, then there should be a new file");
assertEquals(5, counts, "If the number of records are more than 1150, then there should be a new file");
}
@Test