You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by ankitsinghal <gi...@git.apache.org> on 2017/02/13 07:52:18 UTC

[GitHub] phoenix pull request #229: PHOENIX-3572 Support FETCH NEXT|n ROWS query on c...

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.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---