-
Notifications
You must be signed in to change notification settings - Fork 2.5k
[HUDI-2718] ExternalSpillableMap payload size re-estimation throws ArithmeticException #3955
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
6c6b38a
80fd8fe
6ec10a7
59219ac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -83,7 +83,7 @@ public void simpleInsertTest(ExternalSpillableMap.DiskMapType diskMapType, boole | |
| List<IndexedRecord> iRecords = SchemaTestUtil.generateHoodieTestRecords(0, 100); | ||
| List<String> recordKeys = SpillableMapTestUtils.upsertRecords(iRecords, records); | ||
| assert (recordKeys.size() == 100); | ||
|
|
||
| // Test iterator | ||
| Iterator<HoodieRecord<? extends HoodieRecordPayload>> itr = records.iterator(); | ||
| int cntSize = 0; | ||
|
|
@@ -93,7 +93,7 @@ public void simpleInsertTest(ExternalSpillableMap.DiskMapType diskMapType, boole | |
| assert recordKeys.contains(rec.getRecordKey()); | ||
| } | ||
| assertEquals(recordKeys.size(), cntSize); | ||
|
|
||
| // Test value stream | ||
| List<HoodieRecord<? extends HoodieRecordPayload>> values = records.valueStream().collect(Collectors.toList()); | ||
| cntSize = 0; | ||
|
|
@@ -221,7 +221,9 @@ failureOutputPath, new DefaultSizeEstimator(), | |
|
|
||
| @ParameterizedTest | ||
| @MethodSource("testArguments") | ||
| public void testDataCorrectnessWithUpsertsToDataInMapAndOnDisk(ExternalSpillableMap.DiskMapType diskMapType, boolean isCompressionEnabled) throws IOException, URISyntaxException { | ||
| public void testDataCorrectnessWithUpsertsToDataInMapAndOnDisk(ExternalSpillableMap.DiskMapType diskMapType, | ||
| boolean isCompressionEnabled) throws IOException, | ||
| URISyntaxException { | ||
|
|
||
| Schema schema = HoodieAvroUtils.addMetadataFields(SchemaTestUtil.getSimpleSchema()); | ||
|
|
||
|
|
@@ -274,7 +276,9 @@ record = records.get(key); | |
|
|
||
| @ParameterizedTest | ||
| @MethodSource("testArguments") | ||
| public void testDataCorrectnessWithoutHoodieMetadata(ExternalSpillableMap.DiskMapType diskMapType, boolean isCompressionEnabled) throws IOException, URISyntaxException { | ||
| public void testDataCorrectnessWithoutHoodieMetadata(ExternalSpillableMap.DiskMapType diskMapType, | ||
| boolean isCompressionEnabled) throws IOException, | ||
| URISyntaxException { | ||
|
|
||
| Schema schema = SchemaTestUtil.getSimpleSchema(); | ||
|
|
||
|
|
@@ -339,7 +343,42 @@ record = records.get(key); | |
|
|
||
| // TODO : come up with a performance eval test for spillableMap | ||
| @Test | ||
| public void testLargeInsertUpsert() {} | ||
| public void testLargeInsertUpsert() { | ||
manojpec marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| @Test | ||
| public void testPayloadSizeEstimate() throws IOException, URISyntaxException { | ||
manojpec marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| final ExternalSpillableMap.DiskMapType diskMapType = ExternalSpillableMap.DiskMapType.BITCASK; | ||
| final boolean isCompressionEnabled = false; | ||
| final Schema schema = SchemaTestUtil.getSimpleSchema(); | ||
|
|
||
| ExternalSpillableMap<String, HoodieRecord<? extends HoodieRecordPayload>> records = | ||
| new ExternalSpillableMap<>(16L, basePath, new DefaultSizeEstimator(), | ||
| new HoodieRecordSizeEstimator(schema), diskMapType, isCompressionEnabled); | ||
|
|
||
| List<String> recordKeys = new ArrayList<>(); | ||
|
|
||
| // Put a single record. Payload size estimation happens as part of this initial put. | ||
| HoodieRecord seedRecord = SchemaTestUtil.generateHoodieTestRecordsWithoutHoodieMetadata(0, 1).get(0); | ||
| records.put(seedRecord.getRecordKey(), seedRecord); | ||
|
|
||
| // Remove the key immediately to make the map empty again. | ||
| records.remove(seedRecord.getRecordKey()); | ||
|
|
||
| // Payload size re-estimation should not happen as the map | ||
| // size has not reached the minimum size threshold for | ||
| // recalculation. | ||
| records.put(seedRecord.getRecordKey(), seedRecord); | ||
|
|
||
| // Put more records than the threshold to trigger payload size re-estimation | ||
| while (records.getDiskBasedMapNumEntries() < 1) { | ||
|
||
| List<HoodieRecord> hoodieRecords = SchemaTestUtil.generateHoodieTestRecordsWithoutHoodieMetadata(0, 250); | ||
| hoodieRecords.stream().forEach(r -> { | ||
| records.put(r.getRecordKey(), r); | ||
| recordKeys.add(r.getRecordKey()); | ||
| }); | ||
| } | ||
| } | ||
|
|
||
| private static Stream<Arguments> testArguments() { | ||
| // Arguments : 1. Disk Map Type 2. isCompressionEnabled for BitCaskMap | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.