[ 
https://issues.apache.org/jira/browse/PHOENIX-7229?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17820194#comment-17820194
 ] 

ASF GitHub Bot commented on PHOENIX-7229:
-----------------------------------------

virajjasani commented on code in PR #1832:
URL: https://github.com/apache/phoenix/pull/1832#discussion_r1501117059


##########
phoenix-core-client/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java:
##########
@@ -936,7 +938,17 @@ private ScansWithRegionLocations getParallelScans(byte[] 
startKey, byte[] stopKe
         if (!isLocalIndex && scanRanges.isPointLookup() && 
!scanRanges.useSkipScanFilter()) {
             List<List<Scan>> parallelScans = 
Lists.newArrayListWithExpectedSize(1);
             List<Scan> scans = Lists.newArrayListWithExpectedSize(1);
-            scans.add(context.getScan());
+            Scan scanFromContext = context.getScan();
+            if (scanRanges.getPointLookupCount() == 1) {
+                // leverage bloom filter for single key point lookup by 
turning scan to Get Scan#isGetScan()
+                try {
+                    scanFromContext = new Scan(context.getScan());
+                } catch (IOException e) {
+                    throw new PhoenixIOException(e);
+                }
+                scanFromContext.withStopRow(scanFromContext.getStartRow(), 
scanFromContext.includeStartRow());
+            }

Review Comment:
   Can we directly change stopRow without copying the Scan object?
   
   ```
               if (scanRanges.getPointLookupCount() == 1) {
                   // leverage bloom filter for single key point lookup by 
turning scan to Get Scan#isGetScan()
                   scanFromContext.withStopRow(scanFromContext.getStartRow(), 
true);
               }
   ```





> Leverage bloom filters for single key point lookups
> ---------------------------------------------------
>
>                 Key: PHOENIX-7229
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-7229
>             Project: Phoenix
>          Issue Type: Improvement
>    Affects Versions: 5.1.3
>            Reporter: Tanuj Khurana
>            Assignee: Tanuj Khurana
>            Priority: Major
>
> PHOENIX-6710 enabled bloom filters by default when Phoenix tables are 
> created. However, we were not making use of it because Phoenix translates 
> point lookups to scans with the scan range [startkey, stopkey) where startkey 
> is inclusive and is equal to the row key and stopkey is exclusive and is the 
> next key after the row key. 
> This fails the check inside the hbase code in 
> [StoreFileReader#passesBloomFilter|https://github.com/apache/hbase/blob/master/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileReader.java#L245-L250]
>  because it applies bloom filter only to scans which are gets and a scan is a 
> GET only if startkey = stopkey and both are inclusive. This is defined here 
> [Scan#isGetScan|https://github.com/apache/hbase/blob/master/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Scan.java#L253-L255]
> We recently have some customers whose use case involves doing point lookups 
> where the row key is not going to be present in the table. Bloom filters are 
> ideal for those use cases.
> We can change our scan range for point lookups to leverage Bloom filters.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to