hudi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [incubator-hudi] loagosad opened a new issue #1438: How to get the file name corresponding to HoodieKey through the GlobalBloomIndex
Date Mon, 23 Mar 2020 11:26:57 GMT
loagosad opened a new issue #1438: How to get the file name corresponding to HoodieKey through
the GlobalBloomIndex 
URL: https://github.com/apache/incubator-hudi/issues/1438
 
 
   I use the `fetchRecordLocation` method in BloomIndex, which returns null, but in fact needs
to return the corresponding file path.   The test code is as follows.
   ```
   @Test
     public void testROViewWithGlobalBloom() {
           List<HoodieKey> records = new ArrayList<>();
           records.add(new HoodieKey("5bca0f72-8e20-41be-a334-572fafc23201", null));
           records.add(new HoodieKey("b8b16798-6ea8-4bde-9440-90ee1e6b2dc2", null));
           records.add(new HoodieKey("c77d1f18-7f6b-4aa3-a6fa-64ec6986cba6", null));
           records.add(new HoodieKey("33f5a5b1-aefe-4393-9a92-9637759d5072", null));
           records.add(new HoodieKey("f2c6138d-6fd5-42ae-983b-8938a5e51ee6", null));
           records.add(new HoodieKey("1796b537-0d57-43f5-8d00-3fb1575cd5a8", null));
           JavaRDD<HoodieKey> hoodieKeys = jsc.parallelize(records);
           String basePath = "/data/hoodie_base";
           HoodieWriteConfig clientConfig =
                   HoodieWriteConfig.newBuilder()
                           .withPath(basePath)
                           //  we use HoodieGlobalBloomIndex
                           .withIndexConfig(HoodieIndexConfig.newBuilder().withIndexType(HoodieIndex.IndexType.GLOBAL_BLOOM).build())
                           .build();
           HoodieTableMetaClient metaClient = new HoodieTableMetaClient(jsc.hadoopConfiguration(),
basePath, true);
           HoodieTable hoodieTable = HoodieTable.getHoodieTable(metaClient, clientConfig,
jsc);
           HoodieIndex index = hoodieTable.getIndex();
           long startTime = System.currentTimeMillis();
           JavaPairRDD<HoodieKey, Option<Pair<String, String>>> lookupResultRDD
=
                   index.fetchRecordLocation(hoodieKeys, jsc, hoodieTable);
           JavaPairRDD<HoodieKey, Option<String>> keyToFileRDD =
                   lookupResultRDD.mapToPair(r -> new Tuple2<>(r._1, convertToDataFilePath(r._2,
hoodieTable)));
           List<Path> paths = keyToFileRDD.filter(keyFileTuple -> keyFileTuple._2().isPresent())
                   .map(keyFileTuple -> new Path(keyFileTuple._2().get())).distinct().collect();
           System.out.println(String.format("=====PATH=====time cost: %d" ,System.currentTimeMillis()-startTime));
           System.out.println(paths);
       }
   ```
   
   **How can i to get the file name corresponding to HoodieKey through the GlobalBloomIndex
?**

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message