Skip to content

Commit

Permalink
[BugFix] Use snapshot id for PaimonFilter to avoid cache coherency pr…
Browse files Browse the repository at this point in the history
…oblem

Signed-off-by: Jiao Mingye <mxdzs0612@gmail.com>
  • Loading branch information
mxdzs0612 committed Feb 11, 2025
1 parent 18f1714 commit 3a4510f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 67 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import com.starrocks.connector.GetRemoteFilesParams;
import com.starrocks.connector.HdfsEnvironment;
import com.starrocks.connector.PartitionInfo;
import com.starrocks.connector.PredicateSearchKey;
import com.starrocks.connector.RemoteFileDesc;
import com.starrocks.connector.RemoteFileInfo;
import com.starrocks.connector.TableVersionRange;
Expand Down Expand Up @@ -78,7 +79,7 @@ public class PaimonMetadata implements ConnectorMetadata {
private final String catalogName;
private final Map<Identifier, Table> tables = new ConcurrentHashMap<>();
private final Map<String, Database> databases = new ConcurrentHashMap<>();
private final Map<PaimonFilter, PaimonSplitsInfo> paimonSplits = new ConcurrentHashMap<>();
private final Map<PredicateSearchKey, PaimonSplitsInfo> paimonSplits = new ConcurrentHashMap<>();
private final Map<String, Long> partitionInfos = new ConcurrentHashMap<>();
private final ConnectorProperties properties;

Expand Down Expand Up @@ -249,9 +250,12 @@ public boolean tableExists(String dbName, String tableName) {
public List<RemoteFileInfo> getRemoteFiles(Table table, GetRemoteFilesParams params) {
RemoteFileInfo remoteFileInfo = new RemoteFileInfo();
PaimonTable paimonTable = (PaimonTable) table;
PaimonFilter filter =
new PaimonFilter(paimonTable.getCatalogDBName(), paimonTable.getCatalogTableName(), params.getPredicate(),
params.getFieldNames());
long latestSnapshotId = -1L;
if (paimonTable.getNativeTable().latestSnapshotId().isPresent()) {
latestSnapshotId = paimonTable.getNativeTable().latestSnapshotId().getAsLong();
}
PredicateSearchKey filter = PredicateSearchKey.of(paimonTable.getCatalogDBName(),
paimonTable.getCatalogTableName(), latestSnapshotId, params.getPredicate());
if (!paimonSplits.containsKey(filter)) {
ReadBuilder readBuilder = paimonTable.getNativeTable().newReadBuilder();
int[] projected =
Expand Down

0 comments on commit 3a4510f

Please sign in to comment.