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/06/09 18:15:29 UTC
[1/4] phoenix git commit: PHOENIX-2898 HTable not closed in
ConnectionQueryServicesImpl (Alex Araujo)
Repository: phoenix
Updated Branches:
refs/heads/master 4b42f16b2 -> ec02daf34
PHOENIX-2898 HTable not closed in ConnectionQueryServicesImpl (Alex Araujo)
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/94c4b2a0
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/94c4b2a0
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/94c4b2a0
Branch: refs/heads/master
Commit: 94c4b2a08296f3e6948e028cceeb5c3472b7e2c9
Parents: 3de0170
Author: James Taylor <ja...@apache.org>
Authored: Thu May 26 14:41:23 2016 -0700
Committer: James Taylor <ja...@apache.org>
Committed: Thu Jun 9 08:00:10 2016 -0700
----------------------------------------------------------------------
.../phoenix/query/ConnectionQueryServicesImpl.java | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/phoenix/blob/94c4b2a0/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
index c29c0bf..8592a7f 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
@@ -1156,6 +1156,7 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement
boolean isIncompatible = false;
int minHBaseVersion = Integer.MAX_VALUE;
boolean isTableNamespaceMappingEnabled = false;
+ HTableInterface ht = null;
try {
List<HRegionLocation> locations = this
.getAllTableRegions(metaTable);
@@ -1170,8 +1171,7 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement
}
}
- HTableInterface ht = this
- .getTable(metaTable);
+ ht = this.getTable(metaTable);
final Map<byte[], Long> results =
ht.coprocessorService(MetaDataService.class, null, null, new Batch.Call<MetaDataService,Long>() {
@Override
@@ -1219,6 +1219,14 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement
throw new SQLExceptionInfo.Builder(SQLExceptionCode.INCOMPATIBLE_CLIENT_SERVER_JAR).setRootCause(t)
.setMessage("Ensure that " + QueryConstants.DEFAULT_COPROCESS_PATH + " is put on the classpath of HBase in every region server: " + t.getMessage())
.build().buildException();
+ } finally {
+ if (ht != null) {
+ try {
+ ht.close();
+ } catch (IOException e) {
+ logger.warn("Could not close HTable", e);
+ }
+ }
}
if (isIncompatible) {
buf.setLength(buf.length()-1);
[3/4] phoenix git commit: PHOENIX-2899 Add test for inflight
transactions over partially evaluating filters
Posted by ja...@apache.org.
PHOENIX-2899 Add test for inflight transactions over partially evaluating filters
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/f3520a4d
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/f3520a4d
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/f3520a4d
Branch: refs/heads/master
Commit: f3520a4d9678d6f42db16547df68dc4bf647538a
Parents: 4b42f16
Author: James Taylor <ja...@apache.org>
Authored: Sat May 21 10:22:34 2016 -0700
Committer: James Taylor <ja...@apache.org>
Committed: Thu Jun 9 08:00:10 2016 -0700
----------------------------------------------------------------------
.../org/apache/phoenix/tx/TransactionIT.java | 48 +++++++++++++++++++-
1 file changed, 47 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/phoenix/blob/f3520a4d/phoenix-core/src/it/java/org/apache/phoenix/tx/TransactionIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/tx/TransactionIT.java b/phoenix-core/src/it/java/org/apache/phoenix/tx/TransactionIT.java
index 6628d14..d3f54fe 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/tx/TransactionIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/tx/TransactionIT.java
@@ -26,13 +26,13 @@ import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.sql.Connection;
+import java.sql.DatabaseMetaData;
import java.sql.Date;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
-import java.sql.DatabaseMetaData;
import java.util.List;
import java.util.Map;
import java.util.Properties;
@@ -894,4 +894,50 @@ public class TransactionIT extends BaseHBaseManagedTimeIT {
"false", rs2.getString(PhoenixDatabaseMetaData.TRANSACTIONAL));
}
}
+
+ @Test
+ public void testInflightPartialEval() throws SQLException {
+
+ try (Connection conn = DriverManager.getConnection(getUrl())) {
+ String transactTableName = "TR";
+ Statement stmt = conn.createStatement();
+ stmt.execute("CREATE TABLE " + transactTableName + " (k VARCHAR PRIMARY KEY, v1 VARCHAR, v2 VARCHAR) " +
+ "TRANSACTIONAL=true");
+
+ try (Connection conn1 = DriverManager.getConnection(getUrl()); Connection conn2 = DriverManager.getConnection(getUrl())) {
+ conn1.createStatement().execute("UPSERT INTO tr VALUES ('a','b','x')");
+ // Select to force uncommitted data to be written
+ ResultSet rs = conn1.createStatement().executeQuery("SELECT * FROM tr");
+ assertTrue(rs.next());
+ assertEquals("a", rs.getString(1));
+ assertEquals("b", rs.getString(2));
+ assertFalse(rs.next());
+
+ conn2.createStatement().execute("UPSERT INTO tr VALUES ('a','c','x')");
+ // Select to force uncommitted data to be written
+ rs = conn2.createStatement().executeQuery("SELECT * FROM tr");
+ assertTrue(rs.next());
+ assertEquals("a", rs.getString(1));
+ assertEquals("c", rs.getString(2));
+ assertFalse(rs.next());
+
+ // If the AndExpression were to see the uncommitted row from conn2, the filter would
+ // filter the row out early and no longer continue to evaluate other cells due to
+ // the way partial evaluation holds state.
+ rs = conn1.createStatement().executeQuery("SELECT * FROM tr WHERE v1 != 'c' AND v2 = 'x'");
+ assertTrue(rs.next());
+ assertEquals("a", rs.getString(1));
+ assertEquals("b", rs.getString(2));
+ assertFalse(rs.next());
+
+ // Same as above for conn1 data
+ rs = conn2.createStatement().executeQuery("SELECT * FROM tr WHERE v1 != 'b' AND v2 = 'x'");
+ assertTrue(rs.next());
+ assertEquals("a", rs.getString(1));
+ assertEquals("c", rs.getString(2));
+ assertFalse(rs.next());
+ }
+
+ }
+ }
}
[2/4] phoenix git commit: PHOENIX-2924 Remove staging repository once
Apache Tephra 0.8.0 is released
Posted by ja...@apache.org.
PHOENIX-2924 Remove staging repository once Apache Tephra 0.8.0 is released
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/3de0170c
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/3de0170c
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/3de0170c
Branch: refs/heads/master
Commit: 3de0170c8b5e7dfa0bf6dc4e775dde595e64678a
Parents: f3520a4
Author: James Taylor <ja...@apache.org>
Authored: Thu May 26 13:33:08 2016 -0700
Committer: James Taylor <ja...@apache.org>
Committed: Thu Jun 9 08:00:10 2016 -0700
----------------------------------------------------------------------
pom.xml | 4 ----
1 file changed, 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/phoenix/blob/3de0170c/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 7727fe4..d05d25a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -37,10 +37,6 @@
<repositories>
<repository>
- <id>apache tephra staging</id>
- <url>https://repository.apache.org/content/repositories/orgapachetephra-1001</url>
- </repository>
- <repository>
<id>apache release</id>
<url>https://repository.apache.org/content/repositories/releases/</url>
</repository>
[4/4] phoenix git commit: PHOENIX-2942 Order by incorrect for RVC
Posted by ja...@apache.org.
PHOENIX-2942 Order by incorrect for RVC
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/ec02daf3
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/ec02daf3
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/ec02daf3
Branch: refs/heads/master
Commit: ec02daf34f46163b8d089eb50257fe43f134dc24
Parents: 94c4b2a
Author: James Taylor <ja...@apache.org>
Authored: Thu Jun 9 11:18:48 2016 -0700
Committer: James Taylor <ja...@apache.org>
Committed: Thu Jun 9 11:18:48 2016 -0700
----------------------------------------------------------------------
.../org/apache/phoenix/end2end/OrderByIT.java | 29 +++++++++++++++++++
.../RowValueConstructorExpression.java | 30 +++++++++++---------
2 files changed, 45 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/phoenix/blob/ec02daf3/phoenix-core/src/it/java/org/apache/phoenix/end2end/OrderByIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/OrderByIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/OrderByIT.java
index 1d31eee..2c880e7 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/OrderByIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/OrderByIT.java
@@ -507,4 +507,33 @@ public class OrderByIT extends BaseHBaseManagedTimeIT {
conn.close();
}
}
+
+ @Test
+ public void testOrderByRVC() throws Exception {
+ Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+ Connection conn = DriverManager.getConnection(getUrl(), props);
+ String ddl = "create table test1 (testpk varchar not null primary key, l_quantity decimal(15,2), l_discount decimal(15,2))";
+ conn.createStatement().execute(ddl);
+
+ PreparedStatement stmt = conn.prepareStatement("upsert into test1 values ('a',0.1,0.9)");
+ stmt.execute();
+ stmt = conn.prepareStatement(" upsert into test1 values ('b',0.5,0.5)");
+ stmt.execute();
+ stmt = conn.prepareStatement(" upsert into test1 values ('c',0.9,0.1)");
+ stmt.execute();
+ conn.commit();
+
+ ResultSet rs;
+ stmt = conn.prepareStatement("select l_discount,testpk from test1 order by (l_discount,l_quantity)");
+ rs = stmt.executeQuery();
+ assertTrue(rs.next());
+ assertEquals(0.1, rs.getDouble(1), 0.01);
+ assertEquals("c", rs.getString(2));
+ assertTrue(rs.next());
+ assertEquals(0.5, rs.getDouble(1), 0.01);
+ assertEquals("b", rs.getString(2));
+ assertTrue(rs.next());
+ assertEquals(0.9, rs.getDouble(1), 0.01);
+ assertEquals("a", rs.getString(2));
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/phoenix/blob/ec02daf3/phoenix-core/src/main/java/org/apache/phoenix/expression/RowValueConstructorExpression.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/expression/RowValueConstructorExpression.java b/phoenix-core/src/main/java/org/apache/phoenix/expression/RowValueConstructorExpression.java
index 481368c..15f6e3e 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/expression/RowValueConstructorExpression.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/expression/RowValueConstructorExpression.java
@@ -44,7 +44,7 @@ public class RowValueConstructorExpression extends BaseCompoundExpression {
private ImmutableBytesWritable ptrs[];
private ImmutableBytesWritable literalExprPtr;
- private int counter;
+ private int partialEvalIndex = -1;
private int estimatedByteSize;
public RowValueConstructorExpression() {
@@ -52,7 +52,6 @@ public class RowValueConstructorExpression extends BaseCompoundExpression {
public RowValueConstructorExpression(List<Expression> children, boolean isConstant) {
super(children);
- counter = 0;
estimatedByteSize = 0;
init(isConstant);
}
@@ -108,9 +107,10 @@ public class RowValueConstructorExpression extends BaseCompoundExpression {
@Override
public void reset() {
- counter = 0;
+ partialEvalIndex = 0;
estimatedByteSize = 0;
Arrays.fill(ptrs, null);
+ super.reset();
}
private static int getExpressionByteCount(Expression e) {
@@ -132,30 +132,32 @@ public class RowValueConstructorExpression extends BaseCompoundExpression {
return true;
}
try {
- int j;
- int expressionCount = counter;
- for(j = counter; j < ptrs.length; j++) {
- final Expression expression = children.get(j);
+ boolean isPartialEval = this.partialEvalIndex >= 0;
+ int evalIndex = isPartialEval ? this.partialEvalIndex : 0;
+ int expressionCount = evalIndex;
+ for(; evalIndex < ptrs.length; evalIndex++) {
+ final Expression expression = children.get(evalIndex);
// TODO: handle overflow and underflow
if (expression.evaluate(tuple, ptr)) {
if (ptr.getLength() == 0) {
estimatedByteSize += getExpressionByteCount(expression);
} else {
- expressionCount = j+1;
- ptrs[j] = new ImmutableBytesWritable();
- ptrs[j].set(ptr.get(), ptr.getOffset(), ptr.getLength());
+ expressionCount = evalIndex+1;
+ ptrs[evalIndex] = new ImmutableBytesWritable();
+ ptrs[evalIndex].set(ptr.get(), ptr.getOffset(), ptr.getLength());
estimatedByteSize += ptr.getLength() + (expression.getDataType().isFixedWidth() ? 0 : 1); // 1 extra for the separator byte.
}
- counter++;
} else if (tuple == null || tuple.isImmutable()) {
estimatedByteSize += getExpressionByteCount(expression);
- counter++;
- } else {
+ } else { // Cannot yet be evaluated
return false;
}
}
+ if (isPartialEval) {
+ this.partialEvalIndex = evalIndex; // Move counter forward
+ }
- if (j == ptrs.length) {
+ if (evalIndex == ptrs.length) {
if (expressionCount == 0) {
ptr.set(ByteUtil.EMPTY_BYTE_ARRAY);
return true;