Skip to content

Commit

Permalink
Fix checkstyle.
Browse files Browse the repository at this point in the history
  • Loading branch information
qijiale76 committed Nov 10, 2023
1 parent 7c7320c commit 2329a26
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,9 @@ private void prepareBufferForSend(List<ShuffleBlockInfo> shuffleBlocks, SortWrit
if (combinerRunner != null) {
try {
buffer = combineBuffer(buffer);
LOG.debug("Successfully finished combining.");
if (LOG.isDebugEnabled()) {
LOG.debug("Successfully finished combining.");
}
} catch (Exception e) {
LOG.error("Error occurred while combining in Map:", e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,22 @@ public void testCombineBuffer() throws Exception {
Task.CombinerRunner.create(
jobConf, new TaskAttemptID(), combineInputCounter, reporter, null);

SortWriteBuffer<Text, IntWritable> buffer =
new SortWriteBuffer<Text, IntWritable>(
1, comparator, 10000, keySerializer, valueSerializer);

List<String> wordTable =
Lists.newArrayList(
"apple", "banana", "fruit", "cherry", "Chinese", "America", "Japan", "tomato");
Random random = new Random();
for (int i = 0; i < 8; i++) {
buffer.addRecord(new Text(wordTable.get(i)), new IntWritable(1));
}
for (int i = 0; i < 100; i++) {
int index = random.nextInt(wordTable.size());
buffer.addRecord(new Text(wordTable.get(index)), new IntWritable(1));
}

SortWriteBufferManager<Text, IntWritable> manager =
new SortWriteBufferManager<Text, IntWritable>(
10240,
Expand Down Expand Up @@ -394,22 +410,6 @@ public void testCombineBuffer() throws Exception {
new RssConf(),
combinerRunner);

SortWriteBuffer<Text, IntWritable> buffer =
new SortWriteBuffer<Text, IntWritable>(
1, comparator, 10000, keySerializer, valueSerializer);

List<String> wordTable =
Lists.newArrayList(
"apple", "banana", "fruit", "cherry", "Chinese", "America", "Japan", "tomato");
Random random = new Random();
for (int i = 0; i < 8; i++) {
buffer.addRecord(new Text(wordTable.get(i)), new IntWritable(1));
}
for (int i = 0; i < 100; i++) {
int index = random.nextInt(wordTable.size());
buffer.addRecord(new Text(wordTable.get(index)), new IntWritable(1));
}

buffer.sort();
SortWriteBuffer<Text, IntWritable> newBuffer = manager.combineBuffer(buffer);

Expand Down

0 comments on commit 2329a26

Please sign in to comment.