git commit: PHOENIX-1186 Pass scan for parallel chunk of work through to ParallelIteratorFactory

2014-08-19 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/4.0 9973c1ac6 - c0bb7368c


PHOENIX-1186 Pass scan for parallel chunk of work through to 
ParallelIteratorFactory


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/c0bb7368
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/c0bb7368
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/c0bb7368

Branch: refs/heads/4.0
Commit: c0bb7368c6797c9bdd834387993f671f3caca464
Parents: 9973c1a
Author: James Taylor jamestay...@apache.org
Authored: Tue Aug 19 16:19:07 2014 -0700
Committer: James Taylor jamestay...@apache.org
Committed: Tue Aug 19 16:19:07 2014 -0700

--
 .../MutatingParallelIteratorFactory.java|  3 ++-
 .../apache/phoenix/execute/AggregatePlan.java   |  9 +
 .../phoenix/iterate/ChunkedResultIterator.java  | 21 
 .../phoenix/iterate/ParallelIterators.java  |  4 ++--
 .../phoenix/iterate/SpoolingResultIterator.java |  3 ++-
 5 files changed, 19 insertions(+), 21 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/c0bb7368/phoenix-core/src/main/java/org/apache/phoenix/compile/MutatingParallelIteratorFactory.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/compile/MutatingParallelIteratorFactory.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/compile/MutatingParallelIteratorFactory.java
index fbfce29..df91b1d 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/compile/MutatingParallelIteratorFactory.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/compile/MutatingParallelIteratorFactory.java
@@ -26,6 +26,7 @@ import java.sql.SQLException;
 import java.util.List;
 
 import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.client.Scan;
 import org.apache.phoenix.execute.MutationState;
 import org.apache.phoenix.iterate.ParallelIterators.ParallelIteratorFactory;
 import org.apache.phoenix.iterate.PeekingResultIterator;
@@ -58,7 +59,7 @@ public abstract class MutatingParallelIteratorFactory 
implements ParallelIterato
 abstract protected MutationState mutate(StatementContext context, 
ResultIterator iterator, PhoenixConnection connection) throws SQLException;
 
 @Override
-public PeekingResultIterator newIterator(StatementContext context, 
ResultIterator iterator) throws SQLException {
+public PeekingResultIterator newIterator(StatementContext context, 
ResultIterator iterator, Scan scan) throws SQLException {
 final PhoenixConnection connection = new 
PhoenixConnection(this.connection);
 MutationState state = mutate(context, iterator, connection);
 long totalRowCount = state.getUpdateCount();

http://git-wip-us.apache.org/repos/asf/phoenix/blob/c0bb7368/phoenix-core/src/main/java/org/apache/phoenix/execute/AggregatePlan.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/execute/AggregatePlan.java 
b/phoenix-core/src/main/java/org/apache/phoenix/execute/AggregatePlan.java
index 67c7bb7..d45e036 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/execute/AggregatePlan.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/execute/AggregatePlan.java
@@ -22,6 +22,7 @@ import java.sql.SQLException;
 import java.util.Collections;
 import java.util.List;
 
+import org.apache.hadoop.hbase.client.Scan;
 import org.apache.phoenix.compile.GroupByCompiler.GroupBy;
 import org.apache.phoenix.compile.OrderByCompiler.OrderBy;
 import org.apache.phoenix.compile.RowProjector;
@@ -94,7 +95,7 @@ public class AggregatePlan extends BasicQueryPlan {
 this.services = services;
 }
 @Override
-public PeekingResultIterator newIterator(StatementContext context, 
ResultIterator scanner) throws SQLException {
+public PeekingResultIterator newIterator(StatementContext context, 
ResultIterator scanner, Scan scan) throws SQLException {
 Expression expression = RowKeyExpression.INSTANCE;
 OrderByExpression orderByExpression = new 
OrderByExpression(expression, false, true);
 int threshold = 
services.getProps().getInt(QueryServices.SPOOL_THRESHOLD_BYTES_ATTRIB, 
QueryServicesOptions.DEFAULT_SPOOL_THRESHOLD_BYTES);
@@ -111,9 +112,9 @@ public class AggregatePlan extends BasicQueryPlan {
 this.outerFactory = outerFactory;
 }
 @Override
-public PeekingResultIterator newIterator(StatementContext context, 
ResultIterator scanner) throws SQLException {
-PeekingResultIterator iterator = innerFactory.newIterator(context, 
scanner);
-return outerFactory.newIterator(context, iterator);
+public PeekingResultIterator 

git commit: PHOENIX-1186 Pass scan for parallel chunk of work through to ParallelIteratorFactory

2014-08-19 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/3.0 4b511a0c4 - 0ced64677


PHOENIX-1186 Pass scan for parallel chunk of work through to 
ParallelIteratorFactory


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/0ced6467
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/0ced6467
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/0ced6467

Branch: refs/heads/3.0
Commit: 0ced6467755bea8fbba95d51e5bc229f5b3177dd
Parents: 4b511a0
Author: James Taylor jamestay...@apache.org
Authored: Tue Aug 19 16:19:07 2014 -0700
Committer: James Taylor jamestay...@apache.org
Committed: Tue Aug 19 16:36:52 2014 -0700

--
 .../MutatingParallelIteratorFactory.java|  3 ++-
 .../apache/phoenix/execute/AggregatePlan.java   |  9 +
 .../phoenix/iterate/ChunkedResultIterator.java  | 21 
 .../phoenix/iterate/ParallelIterators.java  |  4 ++--
 .../phoenix/iterate/SpoolingResultIterator.java |  3 ++-
 5 files changed, 19 insertions(+), 21 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/0ced6467/phoenix-core/src/main/java/org/apache/phoenix/compile/MutatingParallelIteratorFactory.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/compile/MutatingParallelIteratorFactory.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/compile/MutatingParallelIteratorFactory.java
index fbfce29..df91b1d 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/compile/MutatingParallelIteratorFactory.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/compile/MutatingParallelIteratorFactory.java
@@ -26,6 +26,7 @@ import java.sql.SQLException;
 import java.util.List;
 
 import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.client.Scan;
 import org.apache.phoenix.execute.MutationState;
 import org.apache.phoenix.iterate.ParallelIterators.ParallelIteratorFactory;
 import org.apache.phoenix.iterate.PeekingResultIterator;
@@ -58,7 +59,7 @@ public abstract class MutatingParallelIteratorFactory 
implements ParallelIterato
 abstract protected MutationState mutate(StatementContext context, 
ResultIterator iterator, PhoenixConnection connection) throws SQLException;
 
 @Override
-public PeekingResultIterator newIterator(StatementContext context, 
ResultIterator iterator) throws SQLException {
+public PeekingResultIterator newIterator(StatementContext context, 
ResultIterator iterator, Scan scan) throws SQLException {
 final PhoenixConnection connection = new 
PhoenixConnection(this.connection);
 MutationState state = mutate(context, iterator, connection);
 long totalRowCount = state.getUpdateCount();

http://git-wip-us.apache.org/repos/asf/phoenix/blob/0ced6467/phoenix-core/src/main/java/org/apache/phoenix/execute/AggregatePlan.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/execute/AggregatePlan.java 
b/phoenix-core/src/main/java/org/apache/phoenix/execute/AggregatePlan.java
index 67c7bb7..d45e036 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/execute/AggregatePlan.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/execute/AggregatePlan.java
@@ -22,6 +22,7 @@ import java.sql.SQLException;
 import java.util.Collections;
 import java.util.List;
 
+import org.apache.hadoop.hbase.client.Scan;
 import org.apache.phoenix.compile.GroupByCompiler.GroupBy;
 import org.apache.phoenix.compile.OrderByCompiler.OrderBy;
 import org.apache.phoenix.compile.RowProjector;
@@ -94,7 +95,7 @@ public class AggregatePlan extends BasicQueryPlan {
 this.services = services;
 }
 @Override
-public PeekingResultIterator newIterator(StatementContext context, 
ResultIterator scanner) throws SQLException {
+public PeekingResultIterator newIterator(StatementContext context, 
ResultIterator scanner, Scan scan) throws SQLException {
 Expression expression = RowKeyExpression.INSTANCE;
 OrderByExpression orderByExpression = new 
OrderByExpression(expression, false, true);
 int threshold = 
services.getProps().getInt(QueryServices.SPOOL_THRESHOLD_BYTES_ATTRIB, 
QueryServicesOptions.DEFAULT_SPOOL_THRESHOLD_BYTES);
@@ -111,9 +112,9 @@ public class AggregatePlan extends BasicQueryPlan {
 this.outerFactory = outerFactory;
 }
 @Override
-public PeekingResultIterator newIterator(StatementContext context, 
ResultIterator scanner) throws SQLException {
-PeekingResultIterator iterator = innerFactory.newIterator(context, 
scanner);
-return outerFactory.newIterator(context, iterator);
+public PeekingResultIterator 

git commit: PHOENIX-1186 Pass scan for parallel chunk of work through to ParallelIteratorFactory

2014-08-19 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/3.0 0ced64677 - 91e5d3a1e


PHOENIX-1186 Pass scan for parallel chunk of work through to 
ParallelIteratorFactory


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/91e5d3a1
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/91e5d3a1
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/91e5d3a1

Branch: refs/heads/3.0
Commit: 91e5d3a1ef4c38650ac840ae30c04b0f31c8f7a0
Parents: 0ced646
Author: James Taylor jamestay...@apache.org
Authored: Tue Aug 19 18:26:56 2014 -0700
Committer: James Taylor jamestay...@apache.org
Committed: Tue Aug 19 18:26:56 2014 -0700

--
 .../phoenix/compile/StatementContext.java   | 23 
 .../phoenix/iterate/ChunkedResultIterator.java  |  6 +
 .../phoenix/iterate/ParallelIterators.java  |  5 ++---
 3 files changed, 8 insertions(+), 26 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/91e5d3a1/phoenix-core/src/main/java/org/apache/phoenix/compile/StatementContext.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/compile/StatementContext.java 
b/phoenix-core/src/main/java/org/apache/phoenix/compile/StatementContext.java
index 387696b..23f6963 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/compile/StatementContext.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/compile/StatementContext.java
@@ -93,29 +93,6 @@ public class StatementContext {
 this.whereConditionColumns = new ArrayListPairbyte[],byte[]();
 }
 
-/**
- * Copy constructor where an altered scan can be set.
- *
- * @param stmtContext the {@code StatementContext} to be copied
- * @param scan the customized scan
- */
-public StatementContext(StatementContext stmtContext, Scan scan) {
-this.statement = stmtContext.statement;
-this.resolver = stmtContext.resolver;
-this.scan = scan;
-this.sequences = stmtContext.sequences;
-this.binds = stmtContext.binds;
-this.aggregates = stmtContext.aggregates;
-this.expressions = stmtContext.expressions;
-this.dateFormat = stmtContext.dateFormat;
-this.dateFormatter = stmtContext.dateFormatter;
-this.dateParser = stmtContext.dateParser;
-this.numberFormat = stmtContext.numberFormat;
-this.tempPtr = new ImmutableBytesWritable();
-this.currentTable = stmtContext.currentTable;
-this.whereConditionColumns = stmtContext.whereConditionColumns;
-}
-
 public String getDateFormat() {
 return dateFormat;
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/91e5d3a1/phoenix-core/src/main/java/org/apache/phoenix/iterate/ChunkedResultIterator.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/iterate/ChunkedResultIterator.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/ChunkedResultIterator.java
index 38e91bd..d7fbe79 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/iterate/ChunkedResultIterator.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/ChunkedResultIterator.java
@@ -30,12 +30,15 @@ import org.apache.phoenix.query.QueryServicesOptions;
 import org.apache.phoenix.schema.TableRef;
 import org.apache.phoenix.schema.tuple.Tuple;
 import org.apache.phoenix.util.ScanUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * {@code PeekingResultIterator} implementation that loads data in chunks. 
This is intended for
  * basic scan plans, to avoid loading large quantities of data from HBase in 
one go.
  */
 public class ChunkedResultIterator implements PeekingResultIterator {
+private static final Logger logger = 
LoggerFactory.getLogger(ChunkedResultIterator.class);
 
 private final ParallelIterators.ParallelIteratorFactory 
delegateIteratorFactory;
 private SingleChunkResultIterator singleChunkResultIterator;
@@ -59,6 +62,7 @@ public class ChunkedResultIterator implements 
PeekingResultIterator {
 @Override
 public PeekingResultIterator newIterator(StatementContext context, 
ResultIterator scanner, Scan scan) throws SQLException {
 scanner.close(); //close the iterator since we don't need it 
anymore.
+if (logger.isDebugEnabled()) 
logger.debug(ChunkedResultIteratorFactory.newIterator over  + 
tableRef.getTable().getName().getString() +  with  + scan);
 return new ChunkedResultIterator(delegateFactory, context, 
tableRef, scan,
 
context.getConnection().getQueryServices().getProps().getLong(
 QueryServices.SCAN_RESULT_CHUNK_SIZE,
@@ -102,6 

git commit: PHOENIX-1186 Pass scan for parallel chunk of work through to ParallelIteratorFactory

2014-08-19 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/4.0 c0bb7368c - 522681bae


PHOENIX-1186 Pass scan for parallel chunk of work through to 
ParallelIteratorFactory


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/522681ba
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/522681ba
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/522681ba

Branch: refs/heads/4.0
Commit: 522681bae36da095a9f79b56951b6f8b033590da
Parents: c0bb736
Author: James Taylor jamestay...@apache.org
Authored: Tue Aug 19 18:35:07 2014 -0700
Committer: James Taylor jamestay...@apache.org
Committed: Tue Aug 19 18:35:07 2014 -0700

--
 .../phoenix/compile/StatementContext.java   | 24 
 .../phoenix/iterate/ChunkedResultIterator.java  |  6 +
 .../phoenix/iterate/ParallelIterators.java  |  5 ++--
 3 files changed, 8 insertions(+), 27 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/522681ba/phoenix-core/src/main/java/org/apache/phoenix/compile/StatementContext.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/compile/StatementContext.java 
b/phoenix-core/src/main/java/org/apache/phoenix/compile/StatementContext.java
index 5bebfd8..1c75527 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/compile/StatementContext.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/compile/StatementContext.java
@@ -102,30 +102,6 @@ public class StatementContext {
 }
 
 /**
- * Copy constructor where an altered scan can be set.
- *
- * @param stmtContext the {@code StatementContext} to be copied
- * @param scan the customized scan
- */
-public StatementContext(StatementContext stmtContext, Scan scan) {
-this.statement = stmtContext.statement;
-this.resolver = stmtContext.resolver;
-this.scan = scan;
-this.sequences = stmtContext.sequences;
-this.binds = stmtContext.binds;
-this.aggregates = stmtContext.aggregates;
-this.expressions = stmtContext.expressions;
-this.dateFormat = stmtContext.dateFormat;
-this.dateFormatter = stmtContext.dateFormatter;
-this.dateParser = stmtContext.dateParser;
-this.numberFormat = stmtContext.numberFormat;
-this.tempPtr = new ImmutableBytesWritable();
-this.currentTable = stmtContext.currentTable;
-this.whereConditionColumns = stmtContext.whereConditionColumns;
-this.dataColumns = stmtContext.getDataColumnsMap();
-}
-
-/**
  * build map from dataColumn to what will be its position in single 
KeyValue value bytes
  * returned from the coprocessor that joins from the index row back to the 
data row.
  * @param column

http://git-wip-us.apache.org/repos/asf/phoenix/blob/522681ba/phoenix-core/src/main/java/org/apache/phoenix/iterate/ChunkedResultIterator.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/iterate/ChunkedResultIterator.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/ChunkedResultIterator.java
index 38e91bd..d7fbe79 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/iterate/ChunkedResultIterator.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/ChunkedResultIterator.java
@@ -30,12 +30,15 @@ import org.apache.phoenix.query.QueryServicesOptions;
 import org.apache.phoenix.schema.TableRef;
 import org.apache.phoenix.schema.tuple.Tuple;
 import org.apache.phoenix.util.ScanUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * {@code PeekingResultIterator} implementation that loads data in chunks. 
This is intended for
  * basic scan plans, to avoid loading large quantities of data from HBase in 
one go.
  */
 public class ChunkedResultIterator implements PeekingResultIterator {
+private static final Logger logger = 
LoggerFactory.getLogger(ChunkedResultIterator.class);
 
 private final ParallelIterators.ParallelIteratorFactory 
delegateIteratorFactory;
 private SingleChunkResultIterator singleChunkResultIterator;
@@ -59,6 +62,7 @@ public class ChunkedResultIterator implements 
PeekingResultIterator {
 @Override
 public PeekingResultIterator newIterator(StatementContext context, 
ResultIterator scanner, Scan scan) throws SQLException {
 scanner.close(); //close the iterator since we don't need it 
anymore.
+if (logger.isDebugEnabled()) 
logger.debug(ChunkedResultIteratorFactory.newIterator over  + 
tableRef.getTable().getName().getString() +  with  + scan);
 return new ChunkedResultIterator(delegateFactory, context, 
tableRef, scan,
 

[1/2] git commit: PHOENIX-1186 Pass scan for parallel chunk of work through to ParallelIteratorFactory

2014-08-19 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/master 1fe4af34f - b5971dae6


PHOENIX-1186 Pass scan for parallel chunk of work through to 
ParallelIteratorFactory


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/5c0a08e5
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/5c0a08e5
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/5c0a08e5

Branch: refs/heads/master
Commit: 5c0a08e523a1f66d25c87af3a1fb396c36dc4249
Parents: 1fe4af3
Author: James Taylor jamestay...@apache.org
Authored: Tue Aug 19 16:19:07 2014 -0700
Committer: James Taylor jamestay...@apache.org
Committed: Tue Aug 19 18:39:34 2014 -0700

--
 .../MutatingParallelIteratorFactory.java|  3 ++-
 .../apache/phoenix/execute/AggregatePlan.java   |  9 +
 .../phoenix/iterate/ChunkedResultIterator.java  | 21 
 .../phoenix/iterate/ParallelIterators.java  |  4 ++--
 .../phoenix/iterate/SpoolingResultIterator.java |  3 ++-
 5 files changed, 19 insertions(+), 21 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/5c0a08e5/phoenix-core/src/main/java/org/apache/phoenix/compile/MutatingParallelIteratorFactory.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/compile/MutatingParallelIteratorFactory.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/compile/MutatingParallelIteratorFactory.java
index fbfce29..df91b1d 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/compile/MutatingParallelIteratorFactory.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/compile/MutatingParallelIteratorFactory.java
@@ -26,6 +26,7 @@ import java.sql.SQLException;
 import java.util.List;
 
 import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.client.Scan;
 import org.apache.phoenix.execute.MutationState;
 import org.apache.phoenix.iterate.ParallelIterators.ParallelIteratorFactory;
 import org.apache.phoenix.iterate.PeekingResultIterator;
@@ -58,7 +59,7 @@ public abstract class MutatingParallelIteratorFactory 
implements ParallelIterato
 abstract protected MutationState mutate(StatementContext context, 
ResultIterator iterator, PhoenixConnection connection) throws SQLException;
 
 @Override
-public PeekingResultIterator newIterator(StatementContext context, 
ResultIterator iterator) throws SQLException {
+public PeekingResultIterator newIterator(StatementContext context, 
ResultIterator iterator, Scan scan) throws SQLException {
 final PhoenixConnection connection = new 
PhoenixConnection(this.connection);
 MutationState state = mutate(context, iterator, connection);
 long totalRowCount = state.getUpdateCount();

http://git-wip-us.apache.org/repos/asf/phoenix/blob/5c0a08e5/phoenix-core/src/main/java/org/apache/phoenix/execute/AggregatePlan.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/execute/AggregatePlan.java 
b/phoenix-core/src/main/java/org/apache/phoenix/execute/AggregatePlan.java
index 67c7bb7..d45e036 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/execute/AggregatePlan.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/execute/AggregatePlan.java
@@ -22,6 +22,7 @@ import java.sql.SQLException;
 import java.util.Collections;
 import java.util.List;
 
+import org.apache.hadoop.hbase.client.Scan;
 import org.apache.phoenix.compile.GroupByCompiler.GroupBy;
 import org.apache.phoenix.compile.OrderByCompiler.OrderBy;
 import org.apache.phoenix.compile.RowProjector;
@@ -94,7 +95,7 @@ public class AggregatePlan extends BasicQueryPlan {
 this.services = services;
 }
 @Override
-public PeekingResultIterator newIterator(StatementContext context, 
ResultIterator scanner) throws SQLException {
+public PeekingResultIterator newIterator(StatementContext context, 
ResultIterator scanner, Scan scan) throws SQLException {
 Expression expression = RowKeyExpression.INSTANCE;
 OrderByExpression orderByExpression = new 
OrderByExpression(expression, false, true);
 int threshold = 
services.getProps().getInt(QueryServices.SPOOL_THRESHOLD_BYTES_ATTRIB, 
QueryServicesOptions.DEFAULT_SPOOL_THRESHOLD_BYTES);
@@ -111,9 +112,9 @@ public class AggregatePlan extends BasicQueryPlan {
 this.outerFactory = outerFactory;
 }
 @Override
-public PeekingResultIterator newIterator(StatementContext context, 
ResultIterator scanner) throws SQLException {
-PeekingResultIterator iterator = innerFactory.newIterator(context, 
scanner);
-return outerFactory.newIterator(context, iterator);
+public PeekingResultIterator 

[2/2] git commit: PHOENIX-1186 Pass scan for parallel chunk of work through to ParallelIteratorFactory

2014-08-19 Thread jamestaylor
PHOENIX-1186 Pass scan for parallel chunk of work through to 
ParallelIteratorFactory


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/b5971dae
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/b5971dae
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/b5971dae

Branch: refs/heads/master
Commit: b5971dae61b36f058d37dbc699548da63a068e4e
Parents: 5c0a08e
Author: James Taylor jamestay...@apache.org
Authored: Tue Aug 19 18:35:07 2014 -0700
Committer: James Taylor jamestay...@apache.org
Committed: Tue Aug 19 18:40:01 2014 -0700

--
 .../phoenix/compile/StatementContext.java   | 24 
 .../phoenix/iterate/ChunkedResultIterator.java  |  6 +
 .../phoenix/iterate/ParallelIterators.java  |  5 ++--
 3 files changed, 8 insertions(+), 27 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/b5971dae/phoenix-core/src/main/java/org/apache/phoenix/compile/StatementContext.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/compile/StatementContext.java 
b/phoenix-core/src/main/java/org/apache/phoenix/compile/StatementContext.java
index 5bebfd8..1c75527 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/compile/StatementContext.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/compile/StatementContext.java
@@ -102,30 +102,6 @@ public class StatementContext {
 }
 
 /**
- * Copy constructor where an altered scan can be set.
- *
- * @param stmtContext the {@code StatementContext} to be copied
- * @param scan the customized scan
- */
-public StatementContext(StatementContext stmtContext, Scan scan) {
-this.statement = stmtContext.statement;
-this.resolver = stmtContext.resolver;
-this.scan = scan;
-this.sequences = stmtContext.sequences;
-this.binds = stmtContext.binds;
-this.aggregates = stmtContext.aggregates;
-this.expressions = stmtContext.expressions;
-this.dateFormat = stmtContext.dateFormat;
-this.dateFormatter = stmtContext.dateFormatter;
-this.dateParser = stmtContext.dateParser;
-this.numberFormat = stmtContext.numberFormat;
-this.tempPtr = new ImmutableBytesWritable();
-this.currentTable = stmtContext.currentTable;
-this.whereConditionColumns = stmtContext.whereConditionColumns;
-this.dataColumns = stmtContext.getDataColumnsMap();
-}
-
-/**
  * build map from dataColumn to what will be its position in single 
KeyValue value bytes
  * returned from the coprocessor that joins from the index row back to the 
data row.
  * @param column

http://git-wip-us.apache.org/repos/asf/phoenix/blob/b5971dae/phoenix-core/src/main/java/org/apache/phoenix/iterate/ChunkedResultIterator.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/iterate/ChunkedResultIterator.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/ChunkedResultIterator.java
index 38e91bd..d7fbe79 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/iterate/ChunkedResultIterator.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/ChunkedResultIterator.java
@@ -30,12 +30,15 @@ import org.apache.phoenix.query.QueryServicesOptions;
 import org.apache.phoenix.schema.TableRef;
 import org.apache.phoenix.schema.tuple.Tuple;
 import org.apache.phoenix.util.ScanUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * {@code PeekingResultIterator} implementation that loads data in chunks. 
This is intended for
  * basic scan plans, to avoid loading large quantities of data from HBase in 
one go.
  */
 public class ChunkedResultIterator implements PeekingResultIterator {
+private static final Logger logger = 
LoggerFactory.getLogger(ChunkedResultIterator.class);
 
 private final ParallelIterators.ParallelIteratorFactory 
delegateIteratorFactory;
 private SingleChunkResultIterator singleChunkResultIterator;
@@ -59,6 +62,7 @@ public class ChunkedResultIterator implements 
PeekingResultIterator {
 @Override
 public PeekingResultIterator newIterator(StatementContext context, 
ResultIterator scanner, Scan scan) throws SQLException {
 scanner.close(); //close the iterator since we don't need it 
anymore.
+if (logger.isDebugEnabled()) 
logger.debug(ChunkedResultIteratorFactory.newIterator over  + 
tableRef.getTable().getName().getString() +  with  + scan);
 return new ChunkedResultIterator(delegateFactory, context, 
tableRef, scan,
 
context.getConnection().getQueryServices().getProps().getLong(