neuyilan commented on code in PR #4423:
URL: https://github.com/apache/paimon/pull/4423#discussion_r1827285441
##########
paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/lookup/PrimaryKeyPartialLookupTable.java:
##########
@@ -108,25 +109,31 @@ public void open() throws Exception {
@Override
public List<InternalRow> get(InternalRow key) throws IOException {
+ Triple<BinaryRow, Integer, InternalRow> partitionAndBucket =
extractPartitionAndBucket(key);
+ InternalRow kv =
+ queryExecutor.lookup(
+ partitionAndBucket.f0, partitionAndBucket.f1,
partitionAndBucket.f2);
+ if (kv == null) {
+ return Collections.emptyList();
+ } else {
+ return Collections.singletonList(kv);
+ }
+ }
+
+ private synchronized Triple<BinaryRow, Integer, InternalRow>
extractPartitionAndBucket(
+ InternalRow key) {
InternalRow adjustedKey = key;
if (keyRearrange != null) {
adjustedKey = keyRearrange.replaceRow(adjustedKey);
}
extractor.setRecord(adjustedKey);
int bucket = extractor.bucket();
BinaryRow partition = extractor.partition();
-
InternalRow trimmedKey = key;
if (trimmedKeyRearrange != null) {
trimmedKey = trimmedKeyRearrange.replaceRow(trimmedKey);
Review Comment:
the same as above
##########
paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/lookup/PrimaryKeyPartialLookupTable.java:
##########
@@ -108,25 +109,31 @@ public void open() throws Exception {
@Override
public List<InternalRow> get(InternalRow key) throws IOException {
+ Triple<BinaryRow, Integer, InternalRow> partitionAndBucket =
extractPartitionAndBucket(key);
+ InternalRow kv =
+ queryExecutor.lookup(
+ partitionAndBucket.f0, partitionAndBucket.f1,
partitionAndBucket.f2);
+ if (kv == null) {
+ return Collections.emptyList();
+ } else {
+ return Collections.singletonList(kv);
+ }
+ }
+
+ private synchronized Triple<BinaryRow, Integer, InternalRow>
extractPartitionAndBucket(
+ InternalRow key) {
InternalRow adjustedKey = key;
if (keyRearrange != null) {
adjustedKey = keyRearrange.replaceRow(adjustedKey);
}
extractor.setRecord(adjustedKey);
int bucket = extractor.bucket();
BinaryRow partition = extractor.partition();
-
InternalRow trimmedKey = key;
if (trimmedKeyRearrange != null) {
trimmedKey = trimmedKeyRearrange.replaceRow(trimmedKey);
Review Comment:
the same as above
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]