You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by ja...@apache.org on 2016/07/24 16:50:54 UTC
[1/2] phoenix git commit: PHOENIX-2900 Unable to find hash cache once
a salted table 's first region has split
Repository: phoenix
Updated Branches:
refs/heads/master 59497d525 -> c307daa5e
PHOENIX-2900 Unable to find hash cache once a salted table 's first region has split
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/96c0f9f7
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/96c0f9f7
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/96c0f9f7
Branch: refs/heads/master
Commit: 96c0f9f7537d218a0848d24965d7dc3ec3140a4c
Parents: 59497d5
Author: James Taylor <ja...@apache.org>
Authored: Sun Jul 24 09:30:31 2016 -0700
Committer: James Taylor <ja...@apache.org>
Committed: Sun Jul 24 09:30:31 2016 -0700
----------------------------------------------------------------------
.../org/apache/phoenix/compile/ScanRanges.java | 5 ++-
.../phoenix/compile/QueryCompilerTest.java | 42 ++++++++++++++++++++
.../phoenix/compile/SaltedScanRangesTest.java | 8 ++++
3 files changed, 54 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/phoenix/blob/96c0f9f7/phoenix-core/src/main/java/org/apache/phoenix/compile/ScanRanges.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/ScanRanges.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/ScanRanges.java
index f3d5bba..95eee60 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/compile/ScanRanges.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/ScanRanges.java
@@ -419,7 +419,10 @@ public class ScanRanges {
return true;
}
- return intersectScan(null, regionStartKey, regionEndKey, 0, false) == HAS_INTERSECTION;
+ boolean crossesSaltBoundary = isSalted && ScanUtil.crossesPrefixBoundary(regionEndKey,
+ ScanUtil.getPrefix(regionStartKey, SaltingUtil.NUM_SALTING_BYTES),
+ SaltingUtil.NUM_SALTING_BYTES);
+ return intersectScan(null, regionStartKey, regionEndKey, 0, crossesSaltBoundary) == HAS_INTERSECTION;
}
public SkipScanFilter getSkipScanFilter() {
http://git-wip-us.apache.org/repos/asf/phoenix/blob/96c0f9f7/phoenix-core/src/test/java/org/apache/phoenix/compile/QueryCompilerTest.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/compile/QueryCompilerTest.java b/phoenix-core/src/test/java/org/apache/phoenix/compile/QueryCompilerTest.java
index 7aab048..c91b855 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/compile/QueryCompilerTest.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/compile/QueryCompilerTest.java
@@ -41,6 +41,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Properties;
+import org.apache.hadoop.hbase.HRegionLocation;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.filter.Filter;
import org.apache.hadoop.hbase.filter.FirstKeyOnlyFilter;
@@ -48,6 +49,7 @@ import org.apache.hadoop.hbase.util.Bytes;
import org.apache.phoenix.compile.OrderByCompiler.OrderBy;
import org.apache.phoenix.coprocessor.BaseScannerRegionObserver;
import org.apache.phoenix.exception.SQLExceptionCode;
+import org.apache.phoenix.execute.HashJoinPlan;
import org.apache.phoenix.expression.Expression;
import org.apache.phoenix.expression.LiteralExpression;
import org.apache.phoenix.expression.aggregator.Aggregator;
@@ -2385,4 +2387,44 @@ public class QueryCompilerTest extends BaseConnectionlessQueryTest {
conn.close();
}
}
+
+ @Test
+ public void testSaltTableJoin() throws Exception{
+
+ PhoenixConnection conn = (PhoenixConnection)DriverManager.getConnection(getUrl());
+ try {
+ conn.createStatement().execute("drop table if exists SALT_TEST2900");
+
+ conn.createStatement().execute(
+ "create table SALT_TEST2900"+
+ "("+
+ "id UNSIGNED_INT not null primary key,"+
+ "appId VARCHAR"+
+ ")SALT_BUCKETS=2");
+
+
+
+ conn.createStatement().execute("drop table if exists RIGHT_TEST2900 ");
+ conn.createStatement().execute(
+ "create table RIGHT_TEST2900"+
+ "("+
+ "appId VARCHAR not null primary key,"+
+ "createTime VARCHAR"+
+ ")");
+
+
+ String sql="select * from SALT_TEST2900 a inner join RIGHT_TEST2900 b on a.appId=b.appId where a.id>=3 and a.id<=5";
+ HashJoinPlan plan = (HashJoinPlan)getQueryPlan(sql, Collections.emptyList());
+ ScanRanges ranges=plan.getContext().getScanRanges();
+
+ List<HRegionLocation> regionLocations=
+ conn.getQueryServices().getAllTableRegions(Bytes.toBytes("SALT_TEST2900"));
+ for (HRegionLocation regionLocation : regionLocations) {
+ assertTrue(ranges.intersectRegion(regionLocation.getRegionInfo().getStartKey(),
+ regionLocation.getRegionInfo().getEndKey(), false));
+ }
+ } finally {
+ conn.close();
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/phoenix/blob/96c0f9f7/phoenix-core/src/test/java/org/apache/phoenix/compile/SaltedScanRangesTest.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/compile/SaltedScanRangesTest.java b/phoenix-core/src/test/java/org/apache/phoenix/compile/SaltedScanRangesTest.java
index f8eb3a0..d89f024 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/compile/SaltedScanRangesTest.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/compile/SaltedScanRangesTest.java
@@ -151,6 +151,14 @@ public class SaltedScanRangesTest {
KeyRange.getKeyRange(ByteUtil.concat(new byte[]{1}, Bytes.toBytes("f")), ByteUtil.concat(new byte[]{1}, Bytes.toBytes("g"))),
true,
false));
+ testCases.addAll(
+ foreach(new KeyRange[][]{{
+ PVarchar.INSTANCE.getKeyRange(Bytes.toBytes("c"), true, KeyRange.UNBOUND, false),
+ }},
+ new int[] {1},
+ KeyRange.getKeyRange(new byte[]{1,0},new byte[]{2,0}),
+ false,
+ true));
return testCases;
}
[2/2] phoenix git commit: PHOENIX-3075 Phoenix-hive module is writing
under ./build instead of ./target (Sergey Soldatov)
Posted by ja...@apache.org.
PHOENIX-3075 Phoenix-hive module is writing under ./build instead of ./target (Sergey Soldatov)
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/c307daa5
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/c307daa5
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/c307daa5
Branch: refs/heads/master
Commit: c307daa5e3233b44221eeff930cb78854c8be515
Parents: 96c0f9f
Author: James Taylor <ja...@apache.org>
Authored: Sun Jul 24 09:50:11 2016 -0700
Committer: James Taylor <ja...@apache.org>
Committed: Sun Jul 24 09:50:11 2016 -0700
----------------------------------------------------------------------
.../src/it/java/org/apache/phoenix/hive/HiveTestUtil.java | 5 +++++
1 file changed, 5 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/phoenix/blob/c307daa5/phoenix-hive/src/it/java/org/apache/phoenix/hive/HiveTestUtil.java
----------------------------------------------------------------------
diff --git a/phoenix-hive/src/it/java/org/apache/phoenix/hive/HiveTestUtil.java b/phoenix-hive/src/it/java/org/apache/phoenix/hive/HiveTestUtil.java
index 57722f8..a234d24 100644
--- a/phoenix-hive/src/it/java/org/apache/phoenix/hive/HiveTestUtil.java
+++ b/phoenix-hive/src/it/java/org/apache/phoenix/hive/HiveTestUtil.java
@@ -81,6 +81,7 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.TreeMap;
+import java.util.UUID;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -293,6 +294,10 @@ public class HiveTestUtil {
qJavaVersionSpecificOutput = new HashSet<String>();
this.clusterType = clusterType;
+ // Using randomUUID for dfs cluster
+ System.setProperty("test.build.data", "target/test-data/hive-" + UUID.randomUUID().toString
+ ());
+
HadoopShims shims = ShimLoader.getHadoopShims();
int numberOfDataNodes = 4;