[2/2] git commit: PHOENIX-1140 Incorrect padding for row key columns (Samarth Jain)

2014-08-04 Thread jamestaylor
PHOENIX-1140 Incorrect padding for row key columns (Samarth Jain)


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

Branch: refs/heads/master
Commit: a9dfc135da7e7093791e0d2e88eca0bbf9909deb
Parents: 90b9ec8
Author: James Taylor 
Authored: Mon Aug 4 11:57:50 2014 -0700
Committer: James Taylor 
Committed: Mon Aug 4 13:01:44 2014 -0700

--
 .../org/apache/phoenix/end2end/QueryMoreIT.java |  19 ++-
 .../org/apache/phoenix/end2end/QueryPlanIT.java |   5 +-
 .../phoenix/end2end/RowValueConstructorIT.java  | 136 +++
 .../phoenix/end2end/VariableLengthPKIT.java |  10 +-
 .../org/apache/phoenix/compile/ScanRanges.java  |  12 +-
 .../apache/phoenix/compile/WhereOptimizer.java  |  21 ++-
 .../phoenix/expression/CaseExpression.java  |   6 -
 .../phoenix/expression/InListExpression.java|  29 +---
 .../expression/function/PrefixFunction.java |  35 ++--
 .../expression/function/RTrimFunction.java  |  27 ++-
 .../expression/function/ScalarFunction.java |   9 +
 .../java/org/apache/phoenix/query/KeyRange.java |  29 
 .../org/apache/phoenix/schema/PDataType.java|  25 +++
 .../org/apache/phoenix/schema/PTableImpl.java   |   9 +-
 .../java/org/apache/phoenix/util/ByteUtil.java  |  19 ++-
 .../java/org/apache/phoenix/util/ScanUtil.java  |  16 +-
 .../phoenix/compile/QueryCompilerTest.java  |   8 +-
 .../compile/StatementHintsCompilationTest.java  |   2 +-
 .../phoenix/compile/WhereCompilerTest.java  |  10 +-
 .../phoenix/compile/WhereOptimizerTest.java | 166 +++
 .../org/apache/phoenix/util/ScanUtilTest.java   |  36 ++--
 21 files changed, 450 insertions(+), 179 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/a9dfc135/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java
index 50b3d47..5173b0e 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java
@@ -17,7 +17,6 @@
  */
 package org.apache.phoenix.end2end;
 
-import static org.apache.commons.lang.StringUtils.rightPad;
 import static org.junit.Assert.assertEquals;
 
 import java.sql.Connection;
@@ -95,15 +94,20 @@ public class QueryMoreIT extends BaseHBaseManagedTimeIT {
 conn.createStatement().execute(baseDataTableDDL);
 conn.close();
 
-//upsert rows in the history table.
+//upsert rows in the data table.
 Map> historyIdsPerTenant = 
createHistoryTableRows(dataTableName, tenantIds, numRowsPerTenant);
 
-//create sequence. Use the sequence to upsert select records in cursor 
table.
 String tenantId = tenantIds[0];
 String cursorQueryId = "00TcursrqueryId";
 String tenantViewName = dataTableMultiTenant ? ("HISTORY_TABLE" + "_" 
+ tenantId) : null;
 assertEquals(numRowsPerTenant, 
upsertSelectRecordsInCursorTableForTenant(dataTableName, dataTableMultiTenant, 
tenantId, tenantViewName, cursorQueryId));
 
+Connection conn2 = DriverManager.getConnection(getUrl());
+ResultSet rs = conn2.createStatement().executeQuery("SELECT count(*) 
from " + cursorTableName);
+rs.next();
+assertEquals(numRowsPerTenant, rs.getInt(1));
+conn2.close();
+
 int startOrder = 0;
 int endOrder = 5;
 int numRecordsThatShouldBeRetrieved = 5;
@@ -132,9 +136,10 @@ public class QueryMoreIT extends BaseHBaseManagedTimeIT {
 List parentIds = new ArrayList();
 for (int i = 0; i < numRowsPerTenant; i++) {
 stmt.setString(1, tenantIds[j]);
-stmt.setString(2, rightPad("parentId", 15, 'p'));
+String parentId = "parentId" + i;
+stmt.setString(2, parentId);
 stmt.setDate(3, new Date(100));
-String historyId = rightPad("history" + i, 15, 'h'); 
+String historyId = "historyId" + i; 
 stmt.setString(4, historyId);
 stmt.setString(5, "datatype");
 stmt.setString(6, "oldval");
@@ -154,6 +159,8 @@ public class QueryMoreIT extends BaseHBaseManagedTimeIT {
 private int upsertSelectRecordsInCursorTableForTenant(String 
baseTableName, boolean dataTableMultiTenant, String tenantId, String 
tenantViewName, String cursorQueryId) throws Exception {
  

[2/2] git commit: PHOENIX-1140 Incorrect padding for row key columns (Samarth Jain)

2014-08-04 Thread jamestaylor
PHOENIX-1140 Incorrect padding for row key columns (Samarth Jain)


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

Branch: refs/heads/4.0
Commit: 67d3b24d97c39e98ac8c8338073adf0fe1d0ec8b
Parents: 0c9863e
Author: James Taylor 
Authored: Mon Aug 4 11:57:50 2014 -0700
Committer: James Taylor 
Committed: Mon Aug 4 11:59:03 2014 -0700

--
 .../org/apache/phoenix/end2end/QueryMoreIT.java |  19 ++-
 .../org/apache/phoenix/end2end/QueryPlanIT.java |   5 +-
 .../phoenix/end2end/RowValueConstructorIT.java  | 136 +++
 .../phoenix/end2end/VariableLengthPKIT.java |  10 +-
 .../org/apache/phoenix/compile/ScanRanges.java  |  12 +-
 .../apache/phoenix/compile/WhereOptimizer.java  |  21 ++-
 .../phoenix/expression/CaseExpression.java  |   6 -
 .../phoenix/expression/InListExpression.java|  29 +---
 .../expression/function/PrefixFunction.java |  35 ++--
 .../expression/function/RTrimFunction.java  |  27 ++-
 .../expression/function/ScalarFunction.java |   9 +
 .../java/org/apache/phoenix/query/KeyRange.java |  29 
 .../org/apache/phoenix/schema/PDataType.java|  25 +++
 .../org/apache/phoenix/schema/PTableImpl.java   |   9 +-
 .../java/org/apache/phoenix/util/ByteUtil.java  |  19 ++-
 .../java/org/apache/phoenix/util/ScanUtil.java  |  16 +-
 .../phoenix/compile/QueryCompilerTest.java  |   8 +-
 .../compile/StatementHintsCompilationTest.java  |   2 +-
 .../phoenix/compile/WhereCompilerTest.java  |  10 +-
 .../phoenix/compile/WhereOptimizerTest.java | 166 +++
 .../org/apache/phoenix/util/ScanUtilTest.java   |  36 ++--
 21 files changed, 450 insertions(+), 179 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/67d3b24d/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java
index 50b3d47..5173b0e 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java
@@ -17,7 +17,6 @@
  */
 package org.apache.phoenix.end2end;
 
-import static org.apache.commons.lang.StringUtils.rightPad;
 import static org.junit.Assert.assertEquals;
 
 import java.sql.Connection;
@@ -95,15 +94,20 @@ public class QueryMoreIT extends BaseHBaseManagedTimeIT {
 conn.createStatement().execute(baseDataTableDDL);
 conn.close();
 
-//upsert rows in the history table.
+//upsert rows in the data table.
 Map> historyIdsPerTenant = 
createHistoryTableRows(dataTableName, tenantIds, numRowsPerTenant);
 
-//create sequence. Use the sequence to upsert select records in cursor 
table.
 String tenantId = tenantIds[0];
 String cursorQueryId = "00TcursrqueryId";
 String tenantViewName = dataTableMultiTenant ? ("HISTORY_TABLE" + "_" 
+ tenantId) : null;
 assertEquals(numRowsPerTenant, 
upsertSelectRecordsInCursorTableForTenant(dataTableName, dataTableMultiTenant, 
tenantId, tenantViewName, cursorQueryId));
 
+Connection conn2 = DriverManager.getConnection(getUrl());
+ResultSet rs = conn2.createStatement().executeQuery("SELECT count(*) 
from " + cursorTableName);
+rs.next();
+assertEquals(numRowsPerTenant, rs.getInt(1));
+conn2.close();
+
 int startOrder = 0;
 int endOrder = 5;
 int numRecordsThatShouldBeRetrieved = 5;
@@ -132,9 +136,10 @@ public class QueryMoreIT extends BaseHBaseManagedTimeIT {
 List parentIds = new ArrayList();
 for (int i = 0; i < numRowsPerTenant; i++) {
 stmt.setString(1, tenantIds[j]);
-stmt.setString(2, rightPad("parentId", 15, 'p'));
+String parentId = "parentId" + i;
+stmt.setString(2, parentId);
 stmt.setDate(3, new Date(100));
-String historyId = rightPad("history" + i, 15, 'h'); 
+String historyId = "historyId" + i; 
 stmt.setString(4, historyId);
 stmt.setString(5, "datatype");
 stmt.setString(6, "oldval");
@@ -154,6 +159,8 @@ public class QueryMoreIT extends BaseHBaseManagedTimeIT {
 private int upsertSelectRecordsInCursorTableForTenant(String 
baseTableName, boolean dataTableMultiTenant, String tenantId, String 
tenantViewName, String cursorQueryId) throws Exception {
 

[2/2] git commit: PHOENIX-1140 Incorrect padding for row key columns (Samarth Jain)

2014-08-04 Thread jamestaylor
PHOENIX-1140 Incorrect padding for row key columns (Samarth Jain)


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

Branch: refs/heads/3.0
Commit: e574d1ea888d8d2e29ed787b8ed8edf54905c68b
Parents: ddf970a
Author: James Taylor 
Authored: Mon Aug 4 11:57:50 2014 -0700
Committer: James Taylor 
Committed: Mon Aug 4 11:57:50 2014 -0700

--
 .../org/apache/phoenix/end2end/QueryMoreIT.java |  19 ++-
 .../org/apache/phoenix/end2end/QueryPlanIT.java |   5 +-
 .../phoenix/end2end/RowValueConstructorIT.java  | 136 +++
 .../phoenix/end2end/VariableLengthPKIT.java |  10 +-
 .../org/apache/phoenix/compile/ScanRanges.java  |  12 +-
 .../apache/phoenix/compile/WhereOptimizer.java  |  21 ++-
 .../phoenix/expression/CaseExpression.java  |   6 -
 .../phoenix/expression/InListExpression.java|  29 +---
 .../expression/function/PrefixFunction.java |  35 ++--
 .../expression/function/RTrimFunction.java  |  27 ++-
 .../expression/function/ScalarFunction.java |   9 +
 .../java/org/apache/phoenix/query/KeyRange.java |  29 
 .../org/apache/phoenix/schema/PDataType.java|  25 +++
 .../org/apache/phoenix/schema/PTableImpl.java   |   9 +-
 .../java/org/apache/phoenix/util/ByteUtil.java  |  19 ++-
 .../java/org/apache/phoenix/util/ScanUtil.java  |  16 +-
 .../phoenix/compile/QueryCompilerTest.java  |   8 +-
 .../compile/StatementHintsCompilationTest.java  |   2 +-
 .../phoenix/compile/WhereCompilerTest.java  |  10 +-
 .../phoenix/compile/WhereOptimizerTest.java | 166 +++
 .../org/apache/phoenix/util/ScanUtilTest.java   |  36 ++--
 21 files changed, 450 insertions(+), 179 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/e574d1ea/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java
index 50b3d47..5173b0e 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java
@@ -17,7 +17,6 @@
  */
 package org.apache.phoenix.end2end;
 
-import static org.apache.commons.lang.StringUtils.rightPad;
 import static org.junit.Assert.assertEquals;
 
 import java.sql.Connection;
@@ -95,15 +94,20 @@ public class QueryMoreIT extends BaseHBaseManagedTimeIT {
 conn.createStatement().execute(baseDataTableDDL);
 conn.close();
 
-//upsert rows in the history table.
+//upsert rows in the data table.
 Map> historyIdsPerTenant = 
createHistoryTableRows(dataTableName, tenantIds, numRowsPerTenant);
 
-//create sequence. Use the sequence to upsert select records in cursor 
table.
 String tenantId = tenantIds[0];
 String cursorQueryId = "00TcursrqueryId";
 String tenantViewName = dataTableMultiTenant ? ("HISTORY_TABLE" + "_" 
+ tenantId) : null;
 assertEquals(numRowsPerTenant, 
upsertSelectRecordsInCursorTableForTenant(dataTableName, dataTableMultiTenant, 
tenantId, tenantViewName, cursorQueryId));
 
+Connection conn2 = DriverManager.getConnection(getUrl());
+ResultSet rs = conn2.createStatement().executeQuery("SELECT count(*) 
from " + cursorTableName);
+rs.next();
+assertEquals(numRowsPerTenant, rs.getInt(1));
+conn2.close();
+
 int startOrder = 0;
 int endOrder = 5;
 int numRecordsThatShouldBeRetrieved = 5;
@@ -132,9 +136,10 @@ public class QueryMoreIT extends BaseHBaseManagedTimeIT {
 List parentIds = new ArrayList();
 for (int i = 0; i < numRowsPerTenant; i++) {
 stmt.setString(1, tenantIds[j]);
-stmt.setString(2, rightPad("parentId", 15, 'p'));
+String parentId = "parentId" + i;
+stmt.setString(2, parentId);
 stmt.setDate(3, new Date(100));
-String historyId = rightPad("history" + i, 15, 'h'); 
+String historyId = "historyId" + i; 
 stmt.setString(4, historyId);
 stmt.setString(5, "datatype");
 stmt.setString(6, "oldval");
@@ -154,6 +159,8 @@ public class QueryMoreIT extends BaseHBaseManagedTimeIT {
 private int upsertSelectRecordsInCursorTableForTenant(String 
baseTableName, boolean dataTableMultiTenant, String tenantId, String 
tenantViewName, String cursorQueryId) throws Exception {