You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by GitBox <gi...@apache.org> on 2021/01/07 00:36:47 UTC

[GitHub] [phoenix] gjacoby126 commented on a change in pull request #973: PHOENIX-6211 Paged scan filters

gjacoby126 commented on a change in pull request #973:
URL: https://github.com/apache/phoenix/pull/973#discussion_r553021396



##########
File path: phoenix-core/src/main/java/org/apache/phoenix/coprocessor/PagedRegionScanner.java
##########
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.phoenix.coprocessor;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.apache.hadoop.hbase.Cell;
+import org.apache.hadoop.hbase.client.Scan;
+import org.apache.hadoop.hbase.regionserver.Region;
+import org.apache.hadoop.hbase.regionserver.RegionScanner;
+import org.apache.phoenix.filter.PagedFilter;
+
+import static org.apache.phoenix.util.ScanUtil.getDummyResult;
+import static org.apache.phoenix.util.ScanUtil.getPhoenixPagedFilter;
+
+public class PagedRegionScanner extends BaseRegionScanner {
+    protected Region region;
+    protected Scan scan;
+    protected PagedFilter pageFilter;
+	public PagedRegionScanner(Region region, RegionScanner scanner, Scan scan) {
+	    super(scanner);
+	    this.region = region;
+	    this.scan = scan;
+	    pageFilter = getPhoenixPagedFilter(scan);
+	    if (pageFilter != null) {
+	        pageFilter.init();
+        }
+	}
+
+    private boolean next(List<Cell> results, boolean raw) throws IOException {
+	    try {
+            boolean hasMore = raw ? delegate.nextRaw(results) : delegate.next(results);
+            if (pageFilter == null) {
+                return hasMore;
+            }
+            if (!hasMore) {

Review comment:
       @kadirozde - A little confused here: shouldn't we just be resetting the page filter start time if we DON'T have more to read and setting up the scan to resume later if we DO have more to read? the hasMore check is backwards from what I'd expect. 

##########
File path: phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewTTLIT.java
##########
@@ -2596,4 +2606,119 @@ private void deleteIndexData(boolean useGlobalConnection,
 
         return testCases;
     }
+
+    @Test
+    public void testPR() throws Exception {

Review comment:
       From speaking with @kadirozde and @jpisaac offline it appears this test was included by mistake and should be removed. 




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