phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jamestay...@apache.org
Subject [1/2] phoenix git commit: PHOENIX-2666 Performance regression: Aggregate query with filter on table with multiple column families
Date Wed, 17 Feb 2016 01:29:34 GMT
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-0.98 28ce3d6ef -> 4e990c93d


PHOENIX-2666 Performance regression: Aggregate query with filter on table with multiple column
families


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

Branch: refs/heads/4.x-HBase-0.98
Commit: d94afb8df17cf75f28d6d3adb07577f7356008ae
Parents: 28ce3d6
Author: James Taylor <jamestaylor@apache.org>
Authored: Tue Feb 16 17:15:57 2016 -0800
Committer: James Taylor <jamestaylor@apache.org>
Committed: Tue Feb 16 17:24:14 2016 -0800

----------------------------------------------------------------------
 .../phoenix/iterate/BaseResultIterators.java    | 34 ++++++++++----------
 1 file changed, 17 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/d94afb8d/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java
index 2352e94..d8256d7 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java
@@ -18,10 +18,10 @@
 package org.apache.phoenix.iterate;
 
 import static org.apache.phoenix.coprocessor.BaseScannerRegionObserver.EXPECTED_UPPER_REGION_KEY;
+import static org.apache.phoenix.coprocessor.BaseScannerRegionObserver.SCAN_ACTUAL_START_ROW;
 import static org.apache.phoenix.monitoring.GlobalClientMetrics.GLOBAL_FAILED_QUERY_COUNTER;
 import static org.apache.phoenix.monitoring.GlobalClientMetrics.GLOBAL_QUERY_TIMEOUT_COUNTER;
 import static org.apache.phoenix.util.ByteUtil.EMPTY_BYTE_ARRAY;
-import static org.apache.phoenix.coprocessor.BaseScannerRegionObserver.SCAN_ACTUAL_START_ROW;
 
 import java.io.ByteArrayInputStream;
 import java.io.DataInput;
@@ -179,8 +179,15 @@ public abstract class BaseResultIterators extends ExplainTable implements
Result
                     // Project the one column family. We must project a column family since
it's possible
                     // that there are other non declared column families that we need to
ignore.
                     scan.addFamily(table.getColumnFamilies().get(0).getName().getBytes());
-                } else {
-                    if (projector.projectEveryRow()) {
+                } else if (projector.projectEveryRow()) {
+                    if (table.getViewType() == ViewType.MAPPED) {
+                        // Since we don't have the empty key value in MAPPED tables, 
+                        // we must select all CFs in HRS. However, only the
+                        // selected column values are returned back to client.
+                        for (PColumnFamily family : table.getColumnFamilies()) {
+                            scan.addFamily(family.getName().getBytes());
+                        }
+                    } else {
                         byte[] ecf = SchemaUtil.getEmptyColumnFamily(table);
                         // Project empty key value unless the column family containing it
has
                         // been projected in its entirety.
@@ -188,32 +195,25 @@ public abstract class BaseResultIterators extends ExplainTable implements
Result
                             scan.addColumn(ecf, QueryConstants.EMPTY_COLUMN_BYTES);
                         }
                     }
-                }
-                if (table.getViewType() == ViewType.MAPPED) {
-                    if (projector.projectEveryRow()) {
-                        // Since we don't have the empty key value in MAPPED tables, 
-                        // we must select all CFs in HRS. However, only the
-                        // selected column values are returned back to client.
-                        for (PColumnFamily family : table.getColumnFamilies()) {
-                            scan.addFamily(family.getName().getBytes());
-                        }
+                } else {
+                    for (Pair<byte[], byte[]> whereColumn : context.getWhereConditionColumns())
{
+                        scan.addColumn(whereColumn.getFirst(), whereColumn.getSecond());
                     }
-            } 
+                }
             }
             // Add FirstKeyOnlyFilter if there are no references to key value columns
             if (keyOnlyFilter) {
                 ScanUtil.andFilterAtBeginning(scan, new FirstKeyOnlyFilter());
             }
-            
-            // TODO adding all CFs here is not correct. It should be done only after ColumnProjectionOptimization.
+
             if (perScanLimit != null) {
                 ScanUtil.andFilterAtEnd(scan, new PageFilter(perScanLimit));
             }
-    
+
             doColumnProjectionOptimization(context, scan, table, statement);
         }
     }
-    
+
     public BaseResultIterators(QueryPlan plan, Integer perScanLimit, ParallelScanGrouper
scanGrouper) throws SQLException {
         super(plan.getContext(), plan.getTableRef(), plan.getGroupBy(), plan.getOrderBy(),
plan.getStatement().getHint(), plan.getLimit());
         this.plan = plan;


Mime
View raw message