[
https://issues.apache.org/jira/browse/PHOENIX-3572?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15863298#comment-15863298
]
ASF GitHub Bot commented on PHOENIX-3572:
-----------------------------------------
Github user ankitsinghal commented on a diff in the pull request:
https://github.com/apache/phoenix/pull/229#discussion_r100738646
--- Diff:
phoenix-core/src/main/java/org/apache/phoenix/execute/CursorFetchPlan.java ---
@@ -0,0 +1,87 @@
+package org.apache.phoenix.execute;
+
+import java.sql.ParameterMetaData;
+import java.sql.SQLException;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.hadoop.hbase.client.Scan;
+import org.apache.phoenix.compile.ExplainPlan;
+import org.apache.phoenix.compile.GroupByCompiler.GroupBy;
+import org.apache.phoenix.compile.OrderByCompiler.OrderBy;
+import org.apache.phoenix.compile.QueryPlan;
+import org.apache.phoenix.compile.RowProjector;
+import org.apache.phoenix.compile.StatementContext;
+import org.apache.phoenix.iterate.CursorResultIterator;
+import org.apache.phoenix.iterate.ParallelScanGrouper;
+import org.apache.phoenix.iterate.ResultIterator;
+import org.apache.phoenix.jdbc.PhoenixStatement.Operation;
+import org.apache.phoenix.parse.FilterableStatement;
+import org.apache.phoenix.query.KeyRange;
+import org.apache.phoenix.schema.TableRef;
+
+public class CursorFetchPlan extends DelegateQueryPlan {
+
+ //QueryPlan cursorQueryPlan;
+ private CursorResultIterator resultIterator;
+ private int fetchSize;
+
+ public CursorFetchPlan(QueryPlan cursorQueryPlan) {
+ super(cursorQueryPlan);
+ }
+
+
+ @Override
+ public ResultIterator iterator() throws SQLException {
+ // TODO Auto-generated method stub
+ StatementContext context = delegate.getContext();
+ if (resultIterator != null) {
+ return resultIterator;
+ } else {
+ context.getOverallQueryMetrics().startQuery();
+ resultIterator = (CursorResultIterator)
delegate.iterator();
+ return resultIterator;
+ }
+ }
+
+ @Override
+ public ResultIterator iterator(ParallelScanGrouper scanGrouper) throws
SQLException {
+ // TODO Auto-generated method stub
+ StatementContext context = delegate.getContext();
+ if (resultIterator != null) {
+ return resultIterator;
+ } else {
+ context.getOverallQueryMetrics().startQuery();
+ resultIterator = (CursorResultIterator)
delegate.iterator(scanGrouper);
+ return resultIterator;
+ }
+ }
+
+ @Override
+ public ResultIterator iterator(ParallelScanGrouper scanGrouper, Scan
scan) throws SQLException {
+ // TODO Auto-generated method stub
--- End diff --
can you merge these iterators as all are doing the same and base class will
be calling iterator(ParallelScanGrouper scanGrouper, Scan scan) internally from
other overloaded methods with special parameter value.
> Support FETCH NEXT| n ROWS from Cursor
> --------------------------------------
>
> Key: PHOENIX-3572
> URL: https://issues.apache.org/jira/browse/PHOENIX-3572
> Project: Phoenix
> Issue Type: Sub-task
> Reporter: Biju Nair
> Assignee: Biju Nair
>
> Implement required changes to support
> - {{DECLARE}} and {{OPEN}} a cursor
> - query {{FETCH NEXT | n ROWS}} from the cursor
> - {{CLOSE}} the cursor
> Based on the feedback in [PR
> #192|https://github.com/apache/phoenix/pull/192], implement the changes using
> {{ResultSet}}.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)