diff --git a/paimon-benchmark/paimon-micro-benchmarks/src/test/java/org/apache/paimon/benchmark/lookup/LookupWriterBenchmark.java b/paimon-benchmark/paimon-micro-benchmarks/src/test/java/org/apache/paimon/benchmark/lookup/LookupWriterBenchmark.java index 84a1d6cd48f8..d5dfe31f35ce 100644 --- a/paimon-benchmark/paimon-micro-benchmarks/src/test/java/org/apache/paimon/benchmark/lookup/LookupWriterBenchmark.java +++ b/paimon-benchmark/paimon-micro-benchmarks/src/test/java/org/apache/paimon/benchmark/lookup/LookupWriterBenchmark.java @@ -61,11 +61,16 @@ public static List getVarSeg() { } @TestTemplate - void testLookupWriter() { - writeLookupDataBenchmark(generateSequenceInputs(0, recordCount)); + void testLookupWriterSameValue() { + writeLookupDataBenchmark(generateSequenceInputs(0, recordCount), true); } - public void writeLookupDataBenchmark(byte[][] inputs) { + @TestTemplate + void testLookupWriterDiffValue() { + writeLookupDataBenchmark(generateSequenceInputs(0, recordCount), false); + } + + private void writeLookupDataBenchmark(byte[][] inputs, boolean sameValue) { Benchmark benchmark = new Benchmark("writer-" + inputs.length, inputs.length) .setNumWarmupIters(1) @@ -84,7 +89,7 @@ public void writeLookupDataBenchmark(byte[][] inputs) { 5, () -> { try { - writeData(options, inputs, valueLength); + writeData(options, inputs, valueLength, sameValue); } catch (IOException e) { throw new RuntimeException(e); } @@ -95,10 +100,12 @@ public void writeLookupDataBenchmark(byte[][] inputs) { benchmark.run(); } - private void writeData(CoreOptions options, byte[][] inputs, int valueLength) + private void writeData(CoreOptions options, byte[][] inputs, int valueLength, boolean sameValue) throws IOException { - byte[] value = new byte[valueLength]; - Arrays.fill(value, (byte) 1); + byte[] value1 = new byte[valueLength]; + byte[] value2 = new byte[valueLength]; + Arrays.fill(value1, (byte) 1); + Arrays.fill(value2, (byte) 2); LookupStoreFactory factory = LookupStoreFactory.create( options, @@ -108,8 +115,16 @@ private void writeData(CoreOptions options, byte[][] inputs, int valueLength) File file = new File(tempDir.toFile(), UUID.randomUUID().toString()); LookupStoreWriter writer = factory.createWriter(file, null); + boolean first = true; for (byte[] input : inputs) { - writer.put(input, value); + if (first) { + writer.put(input, value1); + } else { + writer.put(input, value2); + } + if (!sameValue) { + first = !first; + } } writer.close(); }