This is an automated email from the ASF dual-hosted git repository.

yihua pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hudi.git


The following commit(s) were added to refs/heads/master by this push:
     new 9b7e539a902 [MINOR] HFileBootstrapIndex: use try-with-resources in two 
places (#9813)
9b7e539a902 is described below

commit 9b7e539a902cb2cf594a799957af260cf00ab8b4
Author: Tim Brown <t...@onehouse.ai>
AuthorDate: Wed Oct 18 01:21:51 2023 -0500

    [MINOR] HFileBootstrapIndex: use try-with-resources in two places (#9813)
---
 .../org/apache/hudi/common/bootstrap/index/HFileBootstrapIndex.java | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git 
a/hudi-common/src/main/java/org/apache/hudi/common/bootstrap/index/HFileBootstrapIndex.java
 
b/hudi-common/src/main/java/org/apache/hudi/common/bootstrap/index/HFileBootstrapIndex.java
index 0d821ffe103..27314f150dc 100644
--- 
a/hudi-common/src/main/java/org/apache/hudi/common/bootstrap/index/HFileBootstrapIndex.java
+++ 
b/hudi-common/src/main/java/org/apache/hudi/common/bootstrap/index/HFileBootstrapIndex.java
@@ -322,8 +322,7 @@ public class HFileBootstrapIndex extends BootstrapIndex {
 
     @Override
     public List<BootstrapFileMapping> getSourceFileMappingForPartition(String 
partition) {
-      try {
-        HFileScanner scanner = partitionIndexReader().getScanner(true, false);
+      try (HFileScanner scanner = partitionIndexReader().getScanner(true, 
false)) {
         KeyValue keyValue = new 
KeyValue(Bytes.toBytes(getPartitionKey(partition)), new byte[0], new byte[0],
             HConstants.LATEST_TIMESTAMP, KeyValue.Type.Put, new byte[0]);
         if (scanner.seekTo(keyValue) == 0) {
@@ -355,8 +354,7 @@ public class HFileBootstrapIndex extends BootstrapIndex {
       // Arrange input Keys in sorted order for 1 pass scan
       List<HoodieFileGroupId> fileGroupIds = new ArrayList<>(ids);
       Collections.sort(fileGroupIds);
-      try {
-        HFileScanner scanner = fileIdIndexReader().getScanner(true, false);
+      try (HFileScanner scanner = fileIdIndexReader().getScanner(true, false)) 
{
         for (HoodieFileGroupId fileGroupId : fileGroupIds) {
           KeyValue keyValue = new 
KeyValue(Bytes.toBytes(getFileGroupKey(fileGroupId)), new byte[0], new byte[0],
               HConstants.LATEST_TIMESTAMP, KeyValue.Type.Put, new byte[0]);

Reply via email to