phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jamestay...@apache.org
Subject git commit: PHOENIX-1186 Pass scan for parallel chunk of work through to ParallelIteratorFactory
Date Wed, 20 Aug 2014 01:27:12 GMT
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 <jamestaylor@apache.org>
Authored: Tue Aug 19 18:26:56 2014 -0700
Committer: James Taylor <jamestaylor@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 ArrayList<Pair<byte[],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 +106,7 @@ public class ChunkedResultIterator implements PeekingResultIterator {
 
     private PeekingResultIterator getResultIterator() throws SQLException {
         if (resultIterator == null) {
+            if (logger.isDebugEnabled()) logger.debug("Get first chunked result iterator
over " + tableRef.getTable().getName().getString() + " with " + scan);
             singleChunkResultIterator = new SingleChunkResultIterator(
                     new TableResultIterator(context, tableRef, scan), chunkSize);
             resultIterator = delegateIteratorFactory.newIterator(context, singleChunkResultIterator,
scan);
@@ -109,6 +114,7 @@ public class ChunkedResultIterator implements PeekingResultIterator {
             singleChunkResultIterator.close();
             scan = ScanUtil.newScan(scan);
             scan.setStartRow(Bytes.add(singleChunkResultIterator.getLastKey(), new byte[]{0}));
+            if (logger.isDebugEnabled()) logger.debug("Get next chunked result iterator over
" + tableRef.getTable().getName().getString() + " with " + scan);
             singleChunkResultIterator = new SingleChunkResultIterator(
                     new TableResultIterator(context, tableRef, scan), chunkSize);
             resultIterator = delegateIteratorFactory.newIterator(context, singleChunkResultIterator,
scan);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/91e5d3a1/phoenix-core/src/main/java/org/apache/phoenix/iterate/ParallelIterators.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/iterate/ParallelIterators.java
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/ParallelIterators.java
index 440b47c..59814cc 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/iterate/ParallelIterators.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/iterate/ParallelIterators.java
@@ -347,13 +347,12 @@ public class ParallelIterators extends ExplainTable implements ResultIterators
{
 
                     @Override
                     public PeekingResultIterator call() throws Exception {
-                        StatementContext scanContext = new StatementContext(context, splitScan);
                         long startTime = System.currentTimeMillis();
-                        ResultIterator scanner = new TableResultIterator(scanContext, tableRef,
splitScan);
+                        ResultIterator scanner = new TableResultIterator(context, tableRef,
splitScan);
                         if (logger.isDebugEnabled()) {
                             logger.debug("Id: " + scanId + ", Time: " + (System.currentTimeMillis()
- startTime) + "ms, Scan: " + splitScan);
                         }
-                        return iteratorFactory.newIterator(scanContext, scanner, splitScan);
+                        return iteratorFactory.newIterator(context, scanner, splitScan);
                     }
 
                     /**


Mime
View raw message