Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
yuzelin committed Jan 6, 2025
1 parent 836ee69 commit 45f9324
Showing 1 changed file with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.apache.paimon.flink.utils.TableScanUtils;
import org.apache.paimon.options.Options;
import org.apache.paimon.predicate.Predicate;
import org.apache.paimon.table.BucketMode;
import org.apache.paimon.table.FileStoreTable;
import org.apache.paimon.table.Table;
import org.apache.paimon.table.source.OutOfRangeException;
Expand Down Expand Up @@ -162,15 +163,20 @@ private void open() throws Exception {
int[] projection = projectFields.stream().mapToInt(fieldNames::indexOf).toArray();
FileStoreTable storeTable = (FileStoreTable) table;

LOG.info("Creating lookup table for {}.", table.name());
if (options.get(LOOKUP_CACHE_MODE) == LookupCacheMode.AUTO
&& new HashSet<>(table.primaryKeys()).equals(new HashSet<>(joinKeys))) {
String message =
String.format(
"{}={} and primary keys equal to join keys, trying to create PrimaryKeyPartialLookupTable.",
LOOKUP_CACHE_MODE.key(),
LookupCacheMode.AUTO);
if (isRemoteServiceAvailable(storeTable)) {
this.lookupTable =
PrimaryKeyPartialLookupTable.createRemoteTable(
storeTable, projection, joinKeys);
LOG.info(
"Created lookup table for {}. Type is PrimaryKeyPartialLookupTable with remote service.",
table.name());
"Remote service is available. Created PrimaryKeyPartialLookupTable with remote service.");
} else {
try {
this.lookupTable =
Expand All @@ -181,9 +187,12 @@ private void open() throws Exception {
joinKeys,
getRequireCachedBucketIds());
LOG.info(
"Created lookup table for {}. Type is PrimaryKeyPartialLookupTable with LocalQueryExecutor.",
table.name());
} catch (UnsupportedOperationException ignore2) {
"Remote service isn't available. Created PrimaryKeyPartialLookupTable with LocalQueryExecutor.");
} catch (UnsupportedOperationException ignore) {
LOG.info(
"Remote service isn't available. Cannot create PrimaryKeyPartialLookupTable with LocalQueryExecutor "
+ "because bucket mode isn't {}. Will create FullCacheLookupTable.",
BucketMode.HASH_FIXED);
}
}
}
Expand All @@ -199,10 +208,7 @@ private void open() throws Exception {
joinKeys,
getRequireCachedBucketIds());
this.lookupTable = FullCacheLookupTable.create(context, options.get(LOOKUP_CACHE_ROWS));
LOG.info(
"Created lookup table for {}. Type is {}.",
table.name(),
lookupTable.getClass().getSimpleName());
LOG.info("Created {}.", lookupTable.getClass().getSimpleName());
}

if (partitionLoader != null) {
Expand Down

0 comments on commit 45f9324

Please sign in to comment.