You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by je...@apache.org on 2014/03/10 05:21:40 UTC
[09/36] git commit: PHOENIX-114
PHOENIX-114
Project: http://git-wip-us.apache.org/repos/asf/incubator-phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-phoenix/commit/2d3989f6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-phoenix/tree/2d3989f6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-phoenix/diff/2d3989f6
Branch: refs/heads/4.0
Commit: 2d3989f66853ef722f5dbc3f076f97f06922fa94
Parents: c22ea09
Author: anoopsjohn <an...@gmail.com>
Authored: Thu Mar 6 09:59:14 2014 +0530
Committer: anoopsjohn <an...@gmail.com>
Committed: Thu Mar 6 09:59:14 2014 +0530
----------------------------------------------------------------------
.../phoenix/iterate/ParallelIterators.java | 52 +++++++-------------
.../java/org/apache/phoenix/parse/HintNode.java | 13 ++++-
2 files changed, 31 insertions(+), 34 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/2d3989f6/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 ac62fb7..447390c 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
@@ -18,20 +18,9 @@
package org.apache.phoenix.iterate;
import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
import java.util.Map.Entry;
-import java.util.NavigableSet;
-import java.util.Set;
-import java.util.TreeMap;
-import java.util.TreeSet;
-import java.util.UUID;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
+import java.util.concurrent.*;
import org.apache.hadoop.hbase.HRegionLocation;
import org.apache.hadoop.hbase.client.Scan;
@@ -40,27 +29,16 @@ import org.apache.hadoop.hbase.filter.PageFilter;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.Pair;
import org.apache.phoenix.compile.GroupByCompiler.GroupBy;
-import org.apache.phoenix.compile.RowProjector;
-import org.apache.phoenix.compile.StatementContext;
+import org.apache.phoenix.compile.*;
import org.apache.phoenix.filter.ColumnProjectionFilter;
import org.apache.phoenix.hbase.index.util.ImmutableBytesPtr;
import org.apache.phoenix.job.JobManager.JobCallable;
-import org.apache.phoenix.parse.FilterableStatement;
-import org.apache.phoenix.parse.HintNode;
-import org.apache.phoenix.query.ConnectionQueryServices;
-import org.apache.phoenix.query.KeyRange;
-import org.apache.phoenix.query.QueryConstants;
-import org.apache.phoenix.query.QueryServices;
-import org.apache.phoenix.schema.PColumnFamily;
-import org.apache.phoenix.schema.PTable;
+import org.apache.phoenix.parse.*;
+import org.apache.phoenix.parse.HintNode.Hint;
+import org.apache.phoenix.query.*;
+import org.apache.phoenix.schema.*;
import org.apache.phoenix.schema.PTable.ViewType;
-import org.apache.phoenix.schema.SaltingUtil;
-import org.apache.phoenix.schema.TableRef;
-import org.apache.phoenix.util.ReadOnlyProps;
-import org.apache.phoenix.util.SQLCloseables;
-import org.apache.phoenix.util.ScanUtil;
-import org.apache.phoenix.util.SchemaUtil;
-import org.apache.phoenix.util.ServerUtil;
+import org.apache.phoenix.util.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -149,9 +127,17 @@ public class ParallelIterators extends ExplainTable implements ResultIterators {
referencedCfCount++;
}
}
- boolean useOptimization = referencedCfCount == 1;
- // when referencedCfCount is >1 we are not using the optimization as of now
- // TODO support adding a HINT in query so that in case of cf count>1 also, this optimization can be applied.
+ boolean useOptimization;
+ if (statement.getHint().hasHint(Hint.SEEK_TO_COLUMN)) {
+ // Do not use the optimization
+ useOptimization = false;
+ } else if (statement.getHint().hasHint(Hint.NO_SEEK_TO_COLUMN)) {
+ // Strictly use the optimization
+ useOptimization = true;
+ } else {
+ // when referencedCfCount is >1 and no Hints, we are not using the optimization
+ useOptimization = referencedCfCount == 1;
+ }
if (useOptimization) {
for (Entry<byte[], NavigableSet<byte[]>> entry : familyMap.entrySet()) {
ImmutableBytesPtr cf = new ImmutableBytesPtr(entry.getKey());
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/2d3989f6/phoenix-core/src/main/java/org/apache/phoenix/parse/HintNode.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/parse/HintNode.java b/phoenix-core/src/main/java/org/apache/phoenix/parse/HintNode.java
index 3519501..ea373b0 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/parse/HintNode.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/parse/HintNode.java
@@ -20,9 +20,10 @@ package org.apache.phoenix.parse;
import java.util.HashMap;
import java.util.Map;
-import com.google.common.collect.ImmutableMap;
import org.apache.phoenix.util.SchemaUtil;
+import com.google.common.collect.ImmutableMap;
+
/**
* Node representing optimizer hints in SQL
@@ -81,6 +82,16 @@ public class HintNode {
* Avoid using star-join optimization.
*/
NO_STAR_JOIN,
+ /**
+ * Avoid using the no seek optimization. When there are many columns which are not selected coming in between 2
+ * selected columns and/or versions of columns, this should be used.
+ */
+ SEEK_TO_COLUMN,
+ /**
+ * Avoid seeks to select specified columns. When there are very less number of columns which are not selected in
+ * between 2 selected columns this will be give better performance.
+ */
+ NO_SEEK_TO_COLUMN,
};
private final Map<Hint,String> hints;