luoyuxia commented on code in PR #1344:
URL: https://github.com/apache/fluss/pull/1344#discussion_r2241934131


##########
fluss-client/src/main/java/com/alibaba/fluss/client/lookup/PrimaryKeyLookuper.java:
##########
@@ -107,14 +108,22 @@ public CompletableFuture<LookupResult> lookup(InternalRow 
lookupKey) {
                 bucketKeyEncoder == primaryKeyEncoder
                         ? pkBytes
                         : bucketKeyEncoder.encodeKey(lookupKey);
-        Long partitionId =
-                partitionGetter == null
-                        ? null
-                        : getPartitionId(
+        Long partitionId = null;
+        if (partitionGetter != null) {
+            try {
+                partitionId =
+                        getPartitionId(
                                 lookupKey,
                                 partitionGetter,
                                 tableInfo.getTablePath(),
                                 metadataUpdater);
+            } catch (PartitionNotExistException e) {
+                CompletableFuture<LookupResult> future = new 
CompletableFuture<>();
+                future.complete(LookupResult.fromSingleRow(null));

Review Comment:
   dito



##########
fluss-client/src/main/java/com/alibaba/fluss/client/lookup/PrefixKeyLookuper.java:
##########
@@ -150,9 +151,18 @@ public CompletableFuture<LookupResult> lookup(InternalRow 
prefixKey) {
 
         Long partitionId = null;
         if (partitionGetter != null) {
-            partitionId =
-                    getPartitionId(
-                            prefixKey, partitionGetter, 
tableInfo.getTablePath(), metadataUpdater);
+            try {
+                partitionId =
+                        getPartitionId(
+                                prefixKey,
+                                partitionGetter,
+                                tableInfo.getTablePath(),
+                                metadataUpdater);
+            } catch (PartitionNotExistException e) {
+                CompletableFuture<LookupResult> future = new 
CompletableFuture<>();
+                future.complete(LookupResult.fromSingleRow(null));

Review Comment:
   nit: CompletableFuture.completedFuture(LookupResult.fromSingleRow(null))



##########
fluss-client/src/main/java/com/alibaba/fluss/client/lookup/LookupResult.java:
##########
@@ -43,6 +43,11 @@ public LookupResult(List<InternalRow> rowList) {
         this.rowList = rowList;
     }
 
+    public static LookupResult fromSingleRow(@Nullable InternalRow row) {
+        return new LookupResult(

Review Comment:
   nit: just delegate to the constructor method. The logic is same. 



-- 
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]

Reply via email to