Skip to content

Commit

Permalink
[core] Make default of 'lookup.local-file-type' to sort (#4622)
Browse files Browse the repository at this point in the history
  • Loading branch information
Aitozi authored Dec 2, 2024
1 parent 6fb887f commit 3c82082
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/layouts/shortcodes/generated/core_configuration.html
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@
</tr>
<tr>
<td><h5>lookup.local-file-type</h5></td>
<td style="word-wrap: break-word;">hash</td>
<td style="word-wrap: break-word;">sort</td>
<td><p>Enum</p></td>
<td>The local file type for lookup.<br /><br />Possible values:<ul><li>"sort": Construct a sorted file for lookup.</li><li>"hash": Construct a hash file for lookup.</li></ul></td>
</tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,10 @@ protected Pair<String, LookupStoreFactory.Context> writeData(
new CacheManager(MemorySize.ofMebiBytes(10)),
keySerializer.createSliceComparator());

File file = new File(tempDir.toFile(), UUID.randomUUID().toString());
String name =
String.format(
"%s-%s-%s", options.lookupLocalFileType(), valueLength, bloomFilterEnabled);
File file = new File(tempDir.toFile(), UUID.randomUUID() + "-" + name);
LookupStoreWriter writer = factory.createWriter(file, createBloomFiler(bloomFilterEnabled));
int i = 0;
for (byte[] input : inputs) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ private void readData(
LookupStoreFactory factory =
LookupStoreFactory.create(
options,
new CacheManager(MemorySize.ofMebiBytes(10)),
new CacheManager(MemorySize.ofMebiBytes(20), 0.5),
new RowCompactedSerializer(RowType.of(new IntType()))
.createSliceComparator());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,7 @@ public class CoreOptions implements Serializable {
public static final ConfigOption<LookupLocalFileType> LOOKUP_LOCAL_FILE_TYPE =
key("lookup.local-file-type")
.enumType(LookupLocalFileType.class)
.defaultValue(LookupLocalFileType.HASH)
.defaultValue(LookupLocalFileType.SORT)
.withDescription("The local file type for lookup.");

public static final ConfigOption<Float> LOOKUP_HASH_LOAD_FACTOR =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ public Cache build() {
org.apache.paimon.shade.guava30.com.google.common.cache.CacheBuilder
.newBuilder()
.weigher(CacheBuilder::weigh)
// The concurrency level determines the number of segment caches in
// Guava,limiting the maximum block entries held in cache. Since we do
// not access this cache concurrently, it is set to 1.
.concurrencyLevel(1)
.maximumWeight(memorySize.getBytes())
.removalListener(this::onRemoval)
.build());
Expand Down

0 comments on commit 3c82082

Please sign in to comment.