phoenix git commit: PHOENIX-3304 Tracing tests failing

2016-09-20 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/master 2d27179b3 -> b4b764236


PHOENIX-3304 Tracing tests failing


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

Branch: refs/heads/master
Commit: b4b7642363c6b9921212b9c4e7ec237dcc88f00e
Parents: 2d27179
Author: James Taylor 
Authored: Tue Sep 20 22:39:19 2016 -0700
Committer: James Taylor 
Committed: Tue Sep 20 22:39:19 2016 -0700

--
 .../apache/phoenix/trace/BaseTracingTestIT.java | 14 -
 .../phoenix/trace/PhoenixTracingEndToEndIT.java | 22 +---
 .../apache/phoenix/trace/TracingTestUtil.java   |  8 +--
 3 files changed, 16 insertions(+), 28 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/b4b76423/phoenix-core/src/it/java/org/apache/phoenix/trace/BaseTracingTestIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/trace/BaseTracingTestIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/trace/BaseTracingTestIT.java
index 7e5d17f..eed5618 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/trace/BaseTracingTestIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/trace/BaseTracingTestIT.java
@@ -38,13 +38,10 @@ import 
org.apache.hadoop.metrics2.impl.ExposedMetricsRecordImpl;
 import org.apache.hadoop.metrics2.lib.ExposedMetricsInfoImpl;
 import org.apache.phoenix.end2end.ParallelStatsDisabledIT;
 import org.apache.phoenix.metrics.MetricInfo;
-import org.apache.phoenix.query.QueryServicesOptions;
-import org.apache.phoenix.schema.TableNotFoundException;
 import org.apache.phoenix.trace.util.Tracing;
 import org.apache.phoenix.trace.util.Tracing.Frequency;
 import org.apache.phoenix.util.PhoenixRuntime;
 import org.apache.phoenix.util.PropertiesUtil;
-import org.junit.Before;
 
 /**
  * Base test for tracing tests - helps manage getting tracing/non-tracing
@@ -52,16 +49,6 @@ import org.junit.Before;
  */
 
 public class BaseTracingTestIT extends ParallelStatsDisabledIT {
-@Before
-public void resetTracingTableIfExists() throws Exception {
-Connection conn = getConnectionWithoutTracing();
-conn.setAutoCommit(true);
-try {
-conn.createStatement().executeUpdate(
-"DELETE FROM " + 
QueryServicesOptions.DEFAULT_TRACING_STATS_TABLE_NAME);
-} catch (TableNotFoundException ignore) {
-}
-}
 
 public static Connection getConnectionWithoutTracing() throws SQLException 
{
 Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
@@ -70,7 +57,6 @@ public class BaseTracingTestIT extends 
ParallelStatsDisabledIT {
 
 public static Connection getConnectionWithoutTracing(Properties props) 
throws SQLException {
 Connection conn = getConnectionWithTracingFrequency(props, 
Frequency.NEVER);
-conn.setAutoCommit(false);
 return conn;
 }
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/b4b76423/phoenix-core/src/it/java/org/apache/phoenix/trace/PhoenixTracingEndToEndIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/trace/PhoenixTracingEndToEndIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/trace/PhoenixTracingEndToEndIT.java
index d6ca23b..8097cc9 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/trace/PhoenixTracingEndToEndIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/trace/PhoenixTracingEndToEndIT.java
@@ -64,25 +64,26 @@ public class PhoenixTracingEndToEndIT extends 
BaseTracingTestIT {
 private String enableForLoggingIndex;
 
 private DisableableMetricsWriter sink;
-private String tableName;
+private String tracingTableName;
 
 @Before
 public void setupMetrics() throws Exception {
 PhoenixMetricsSink pWriter = new PhoenixMetricsSink();
 Connection conn = getConnectionWithoutTracing();
-tableName = generateRandomString();
-pWriter.initForTesting(conn, tableName);
+tracingTableName = "TRACING_" + generateRandomString();
+pWriter.initForTesting(conn, tracingTableName);
 sink = new DisableableMetricsWriter(pWriter);
 enabledForLoggingTable = "ENABLED_FOR_LOGGING_" + 
generateRandomString();
-enableForLoggingIndex = "ENABALED_FOR_LOGGING_INDEX" + 
generateRandomString();
+enableForLoggingIndex = "ENABALED_FOR_LOGGING_INDEX_" + 
generateRandomString();
 
-TracingTestUtil.registerSink(sink);
+TracingTestUtil.registerSink(sink, tracingTableName);
 }
 
 @After
 public void cleanup() {
 sink.disable

Build failed in Jenkins: Phoenix | Master #1410

2016-09-20 Thread Apache Jenkins Server
See 

Changes:

[jamestaylor] PHOENIX-3290 Move and/or combine as many NeedsOwnCluster tests to 
bring

--
[...truncated 760 lines...]
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 4.565 sec - in 
org.apache.phoenix.trace.PhoenixTableMetricsWriterIT
Running org.apache.phoenix.trace.PhoenixTraceReaderIT
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 4.665 sec - in 
org.apache.phoenix.trace.PhoenixTraceReaderIT
Running org.apache.phoenix.trace.PhoenixTracingEndToEndIT
Tests run: 9, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 50.664 sec - in 
org.apache.phoenix.iterate.RoundRobinResultIteratorIT
Running org.apache.phoenix.tx.TransactionIT
Tests run: 36, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 282.333 sec - 
in org.apache.phoenix.end2end.index.LocalIndexIT
Running org.apache.phoenix.tx.TxCheckpointIT
Tests run: 28, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 636.155 sec - 
in org.apache.phoenix.end2end.InListIT
Tests run: 22, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 108.824 sec - 
in org.apache.phoenix.tx.TransactionIT
Tests run: 66, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 453.736 sec - 
in org.apache.phoenix.end2end.index.IndexExpressionIT
Tests run: 20, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 146.217 sec - 
in org.apache.phoenix.tx.TxCheckpointIT
Tests run: 40, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 543.296 sec - 
in org.apache.phoenix.end2end.index.MutableIndexIT
Tests run: 136, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 904.516 sec - 
in org.apache.phoenix.end2end.index.IndexIT
Tests run: 6, Failures: 4, Errors: 0, Skipped: 0, Time elapsed: 840.028 sec <<< 
FAILURE! - in org.apache.phoenix.trace.PhoenixTracingEndToEndIT
testScanTracingOnServer(org.apache.phoenix.trace.PhoenixTracingEndToEndIT)  
Time elapsed: 204.531 sec  <<< FAILURE!
java.lang.AssertionError: Get expected updates to trace table
at 
org.apache.phoenix.trace.PhoenixTracingEndToEndIT.testScanTracingOnServer(PhoenixTracingEndToEndIT.java:341)

testClientServerIndexingTracing(org.apache.phoenix.trace.PhoenixTracingEndToEndIT)
  Time elapsed: 216.966 sec  <<< FAILURE!
java.lang.AssertionError: Never found indexing updates
at 
org.apache.phoenix.trace.PhoenixTracingEndToEndIT.testClientServerIndexingTracing(PhoenixTracingEndToEndIT.java:233)

testScanTracing(org.apache.phoenix.trace.PhoenixTracingEndToEndIT)  Time 
elapsed: 204.523 sec  <<< FAILURE!
java.lang.AssertionError: Get expected updates to trace table
at 
org.apache.phoenix.trace.PhoenixTracingEndToEndIT.testScanTracing(PhoenixTracingEndToEndIT.java:290)

testCustomAnnotationTracing(org.apache.phoenix.trace.PhoenixTracingEndToEndIT)  
Time elapsed: 203.545 sec  <<< FAILURE!
java.lang.AssertionError: Get expected updates to trace table
at 
org.apache.phoenix.trace.PhoenixTracingEndToEndIT.testCustomAnnotationTracing(PhoenixTracingEndToEndIT.java:393)


Results :

Failed tests: 
  PhoenixTracingEndToEndIT.testClientServerIndexingTracing:233 Never found 
indexing updates
  PhoenixTracingEndToEndIT.testCustomAnnotationTracing:393 Get expected updates 
to trace table
  PhoenixTracingEndToEndIT.testScanTracing:290 Get expected updates to trace 
table
  PhoenixTracingEndToEndIT.testScanTracingOnServer:341 Get expected updates to 
trace table

Tests run: 1334, Failures: 4, Errors: 0, Skipped: 5

[INFO] 
[INFO] --- maven-failsafe-plugin:2.19.1:integration-test 
(ClientManagedTimeTests) @ phoenix-core ---

---
 T E S T S
---
Running org.apache.phoenix.end2end.ArrayIT
Running org.apache.phoenix.end2end.ColumnProjectionOptimizationIT
Running org.apache.phoenix.end2end.ClientTimeArithmeticQueryIT
Running org.apache.phoenix.end2end.AggregateQueryIT
Running org.apache.phoenix.end2end.CastAndCoerceIT
Running org.apache.phoenix.end2end.CreateSchemaIT
Running org.apache.phoenix.end2end.CaseStatementIT
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.507 sec - in 
org.apache.phoenix.end2end.CreateSchemaIT
Running org.apache.phoenix.end2end.CreateTableIT
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 26.579 sec - in 
org.apache.phoenix.end2end.ColumnProjectionOptimizationIT
Running org.apache.phoenix.end2end.CustomEntityDataIT
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 6.847 sec - in 
org.apache.phoenix.end2end.CustomEntityDataIT
Running org.apache.phoenix.end2end.DerivedTableIT
Tests run: 49, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 41.338 sec - 
in org.apache.phoenix.end2end.CastAndCoerceIT
Running org.apache.phoenix.end2end.DistinctCountIT
Tests run: 63, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 45.735 sec - 
in org.apache.phoenix.end2end.CaseStatementIT
Running org.apache.phoenix.end2end.DropSchemaI

[3/4] phoenix git commit: PHOENIX-3290 Move and/or combine as many NeedsOwnCluster tests to bring down test run time

2016-09-20 Thread jamestaylor
http://git-wip-us.apache.org/repos/asf/phoenix/blob/2d27179b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryWithOffsetIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryWithOffsetIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryWithOffsetIT.java
index 5e36784..6f190b6 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryWithOffsetIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryWithOffsetIT.java
@@ -38,6 +38,7 @@ import org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.util.PropertiesUtil;
 import org.apache.phoenix.util.QueryUtil;
 import org.apache.phoenix.util.ReadOnlyProps;
+import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -47,23 +48,17 @@ import org.junit.runners.Parameterized.Parameters;
 import com.google.common.collect.Maps;
 
 @RunWith(Parameterized.class)
-public class QueryWithOffsetIT extends BaseOwnClusterHBaseManagedTimeIT {
+public class QueryWithOffsetIT extends ParallelStatsDisabledIT {
 
-private String tableName = "T";
-private final String[] strings = { "a", "b", "c", "d", "e", "f", "g", "h", 
"i", "j", "k", "l", "m", "n", "o", "p",
-"q", "r", "s", "t", "u", "v", "w", "x", "y", "z" };
-private final String ddl;
+private static final String[] STRINGS = { "a", "b", "c", "d", "e", "f", 
"g", "h", "i", "j", "k", "l", "m", "n",
+"o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z" };
 private final boolean isSalted;
-
-public QueryWithOffsetIT(String preSplit) {
-this.tableName=tableName + "_" + preSplit.charAt(2);
-this.ddl = "CREATE TABLE " + tableName + " (t_id VARCHAR NOT NULL,\n" 
+ "k1 INTEGER NOT NULL,\n"
-+ "k2 INTEGER NOT NULL,\n" + "C3.k3 INTEGER,\n" + "C2.v1 
VARCHAR,\n"
-+ "CONSTRAINT pk PRIMARY KEY (t_id, k1, k2)) " + preSplit;
-this.isSalted = preSplit.startsWith(" SALT_BUCKETS");
-}
+private final String preSplit;
+private String ddl;
+private String tableName;
 
 @BeforeClass
+@Shadower(classBeingShadowed = ParallelStatsDisabledIT.class)
 public static void doSetup() throws Exception {
 Map props = Maps.newHashMapWithExpectedSize(1);
 props.put(QueryServices.FORCE_ROW_KEY_ORDER_ATTRIB, 
Boolean.toString(true));
@@ -71,6 +66,19 @@ public class QueryWithOffsetIT extends 
BaseOwnClusterHBaseManagedTimeIT {
 setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator()));
 }
 
+public QueryWithOffsetIT(String preSplit) {
+this.isSalted = preSplit.startsWith(" SALT_BUCKETS");
+this.preSplit = preSplit;
+}
+
+@Before
+public void initTest() {
+tableName = "T_" + generateRandomString();
+ddl = "CREATE TABLE " + tableName + " (t_id VARCHAR NOT NULL,\n" + "k1 
INTEGER NOT NULL,\n"
++ "k2 INTEGER NOT NULL,\n" + "C3.k3 INTEGER,\n" + "C2.v1 
VARCHAR,\n"
++ "CONSTRAINT pk PRIMARY KEY (t_id, k1, k2)) " + preSplit;
+}
+
 @Parameters(name="preSplit = {0}")
 public static Collection data() {
 return Arrays.asList(new String[] { " SPLIT ON ('e','i','o')", " 
SALT_BUCKETS=10" });
@@ -92,7 +100,7 @@ public class QueryWithOffsetIT extends 
BaseOwnClusterHBaseManagedTimeIT {
 int i = 0;
 while (i < limit) {
 assertTrue(rs.next());
-assertEquals("Expected string didn't match for i = " + i, 
strings[offset + i], rs.getString(1));
+assertEquals("Expected string didn't match for i = " + i, 
STRINGS[offset + i], rs.getString(1));
 i++;
 }
 
@@ -100,14 +108,14 @@ public class QueryWithOffsetIT extends 
BaseOwnClusterHBaseManagedTimeIT {
 rs = conn.createStatement().executeQuery("SELECT t_id from " + 
tableName + " union all SELECT t_id from "
 + tableName + " offset " + offset + " FETCH FIRST " + limit + 
" rows only");
 i = 0;
-while (i++ < strings.length - offset) {
+while (i++ < STRINGS.length - offset) {
 assertTrue(rs.next());
-assertEquals(strings[offset + i - 1], rs.getString(1));
+assertEquals(STRINGS[offset + i - 1], rs.getString(1));
 }
 i = 0;
-while (i++ < limit - strings.length - offset) {
+while (i++ < limit - STRINGS.length - offset) {
 assertTrue(rs.next());
-assertEquals(strings[i - 1], rs.getString(1));
+assertEquals(STRINGS[i - 1], rs.getString(1));
 }
 conn.close();
 }
@@ -124,25 +132,27 @@ public class QueryWithOffsetIT extends 
BaseOwnClusterHBaseManagedTimeIT {
 String query = "SELECT t_id from " + tableName + " offset " + offset;
 ResultSet rs = conn.createStatement().executeQuery("EXPLAIN " + query);
 if

[1/4] phoenix git commit: PHOENIX-3290 Move and/or combine as many NeedsOwnCluster tests to bring down test run time

2016-09-20 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/master 7601d5942 -> 2d27179b3


http://git-wip-us.apache.org/repos/asf/phoenix/blob/2d27179b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java
--
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java
index 35e1c62..425e84c 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java
@@ -58,16 +58,17 @@ public class ViewIT extends BaseViewIT {
super(transactional);
}
 
-   @Test
-public void testReadOnlyView() throws Exception {
+@Test
+public void testReadOnlyOnReadOnlyView() throws Exception {
 Connection earlierCon = DriverManager.getConnection(getUrl());
 Connection conn = DriverManager.getConnection(getUrl());
-   String ddl = "CREATE TABLE " + fullTableName + " (k INTEGER NOT 
NULL PRIMARY KEY, v1 DATE) "+ tableDDLOptions;
+String ddl = "CREATE TABLE " + fullTableName + " (k INTEGER NOT NULL 
PRIMARY KEY, v1 DATE) "+ tableDDLOptions;
 conn.createStatement().execute(ddl);
-ddl = "CREATE VIEW v (v2 VARCHAR) AS SELECT * FROM " + tableName + " 
WHERE k > 5";
+String fullParentViewName = "V_" + generateRandomString();
+ddl = "CREATE VIEW " + fullParentViewName + " (v2 VARCHAR) AS SELECT * 
FROM " + tableName + " WHERE k > 5";
 conn.createStatement().execute(ddl);
 try {
-conn.createStatement().execute("UPSERT INTO v VALUES(1)");
+conn.createStatement().execute("UPSERT INTO " + fullParentViewName 
+ " VALUES(1)");
 fail();
 } catch (ReadOnlyTableException e) {
 
@@ -77,42 +78,37 @@ public class ViewIT extends BaseViewIT {
 }
 conn.commit();
 
-analyzeTable(conn, "v", transactional);
+analyzeTable(conn, fullParentViewName, transactional);
 
-List splits = getAllSplits(conn, "v");
+List splits = getAllSplits(conn, fullParentViewName);
 assertEquals(4, splits.size());
 
 int count = 0;
-ResultSet rs = conn.createStatement().executeQuery("SELECT k FROM " + 
tableName);
+ResultSet rs = conn.createStatement().executeQuery("SELECT k FROM " + 
fullTableName);
 while (rs.next()) {
 assertEquals(count++, rs.getInt(1));
 }
 assertEquals(10, count);
 
 count = 0;
-rs = conn.createStatement().executeQuery("SELECT k FROM v");
+rs = conn.createStatement().executeQuery("SELECT k FROM " + 
fullParentViewName);
 while (rs.next()) {
 count++;
 assertEquals(count + 5, rs.getInt(1));
 }
 assertEquals(4, count);
 count = 0;
-rs = earlierCon.createStatement().executeQuery("SELECT k FROM v");
+rs = earlierCon.createStatement().executeQuery("SELECT k FROM " + 
fullParentViewName);
 while (rs.next()) {
 count++;
 assertEquals(count + 5, rs.getInt(1));
 }
 assertEquals(4, count);
-}
-
-@Test
-public void testReadOnlyOnReadOnlyView() throws Exception {
-testReadOnlyView();
-Connection conn = DriverManager.getConnection(getUrl());
-String ddl = "CREATE VIEW v2 AS SELECT * FROM v WHERE k < 9";
+String fullViewName = "V_" + generateRandomString();
+ddl = "CREATE VIEW " + fullViewName + " AS SELECT * FROM " + 
fullParentViewName + " WHERE k < 9";
 conn.createStatement().execute(ddl);
 try {
-conn.createStatement().execute("UPSERT INTO v2 VALUES(1)");
+conn.createStatement().execute("UPSERT INTO " + fullViewName + " 
VALUES(1)");
 fail();
 } catch (ReadOnlyTableException e) {
 
@@ -121,8 +117,8 @@ public class ViewIT extends BaseViewIT {
 }
 
 conn = DriverManager.getConnection(getUrl());
-int count = 0;
-ResultSet rs = conn.createStatement().executeQuery("SELECT k FROM v2");
+count = 0;
+rs = conn.createStatement().executeQuery("SELECT k FROM " + 
fullViewName);
 while (rs.next()) {
 count++;
 assertEquals(count + 5, rs.getInt(1));
@@ -142,20 +138,21 @@ public class ViewIT extends BaseViewIT {
 
 @Test
 public void testUpdatableOnUpdatableView() throws Exception {
-testUpdatableView(null);
+String viewName = testUpdatableView(null);
 Connection conn = DriverManager.getConnection(getUrl());
-String ddl = "CREATE VIEW v2 AS SELECT * FROM v WHERE k3 = 2";
+String fullViewName = "V_" + generateRandomString();
+String ddl = "CREATE VIEW " + fullViewName + " AS SELECT * FROM " + 
viewName + " WHERE k3 = 2";
 con

[2/4] phoenix git commit: PHOENIX-3290 Move and/or combine as many NeedsOwnCluster tests to bring down test run time

2016-09-20 Thread jamestaylor
http://git-wip-us.apache.org/repos/asf/phoenix/blob/2d27179b/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDMLIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDMLIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDMLIT.java
index dbe767b..f26e6dd 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDMLIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDMLIT.java
@@ -28,13 +28,11 @@ import static org.junit.Assert.fail;
 import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.ResultSet;
-import java.sql.SQLException;
 import java.util.List;
 import java.util.Properties;
 
 import org.apache.phoenix.query.KeyRange;
 import org.apache.phoenix.schema.TableNotFoundException;
-import org.apache.phoenix.util.PhoenixRuntime;
 import org.apache.phoenix.util.PropertiesUtil;
 import org.junit.Test;
 
@@ -43,23 +41,20 @@ public class TenantSpecificTablesDMLIT extends 
BaseTenantSpecificTablesIT {

@Test
public void testSelectWithLimit() throws Exception {
-   Connection conn = 
nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL);
+   Connection conn = 
DriverManager.getConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL, 
PropertiesUtil.deepCopy(TEST_PROPERTIES));
 ResultSet rs = conn.createStatement().executeQuery("SELECT * FROM " + 
TENANT_TABLE_NAME + " LIMIT 100");
while(rs.next()) {}
}

 @Test
 public void testBasicUpsertSelect() throws Exception {
-Connection conn = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL);
+Connection conn = 
DriverManager.getConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL, 
PropertiesUtil.deepCopy(TEST_PROPERTIES));
 try {
 conn.setAutoCommit(false);
 conn.createStatement().executeUpdate("upsert into " + 
TENANT_TABLE_NAME + " (id, tenant_col) values (1, 'Cheap Sunglasses')");
 conn.createStatement().executeUpdate("upsert into " + 
TENANT_TABLE_NAME + " (id, tenant_col) values (2, 'Viva Las Vegas')");
 conn.commit();
-conn.close();
-conn = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL);
 analyzeTable(conn, TENANT_TABLE_NAME);
-conn = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL);
 ResultSet rs = conn.createStatement().executeQuery("select 
tenant_col from " + TENANT_TABLE_NAME + " where id = 1");
 assertTrue("Expected 1 row in result set", rs.next());
 assertEquals("Cheap Sunglasses", rs.getString(1));
@@ -72,49 +67,37 @@ public class TenantSpecificTablesDMLIT extends 
BaseTenantSpecificTablesIT {
 
 @Test
 public void testBasicUpsertSelect2() throws Exception {
-Connection conn1 = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL);
-createTestTable(PHOENIX_JDBC_TENANT_SPECIFIC_URL2, TENANT_TABLE_DDL, 
null, nextTimestamp());
-Connection conn2 = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL2);
+Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+Connection conn1 = 
DriverManager.getConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL, props);
+createTestTable(PHOENIX_JDBC_TENANT_SPECIFIC_URL2, TENANT_TABLE_DDL);
+Connection conn2 = 
DriverManager.getConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL2, props);
 try {
 conn1.setAutoCommit(false);
 conn1.createStatement().executeUpdate("upsert into " + 
TENANT_TABLE_NAME + " values ('me','" + TENANT_TYPE_ID + "',1,'Cheap 
Sunglasses')");
 conn1.createStatement().executeUpdate("upsert into " + 
TENANT_TABLE_NAME + " values ('you','" + TENANT_TYPE_ID +"',2,'Viva Las 
Vegas')");
 conn1.commit();
-conn1 = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL);
 analyzeTable(conn1, TENANT_TABLE_NAME);
-conn1 = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL);
 
 conn2.setAutoCommit(true);
 conn2.createStatement().executeUpdate("upsert into " + 
TENANT_TABLE_NAME + " values ('them','" + TENANT_TYPE_ID + "',1,'Long Hair')");
 conn2.createStatement().executeUpdate("upsert into " + 
TENANT_TABLE_NAME + " values ('us','" + TENANT_TYPE_ID + "',2,'Black Hat')");
-conn2.close();
-conn1.close();
-conn1 = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL);
 ResultSet rs = conn1.createStatement().executeQuery("select * from 
" + TENANT_TABLE_NAME + " where id = 1");
 assertTrue("Expected 1 row in result set", rs.next());
 assertEquals(1, rs.getInt(3));
 assertEquals("Cheap Sunglasses", rs.getString(4));
 assertFalse("Expected 1 row in result set", rs.next());
-c

[4/4] phoenix git commit: PHOENIX-3290 Move and/or combine as many NeedsOwnCluster tests to bring down test run time

2016-09-20 Thread jamestaylor
PHOENIX-3290 Move and/or combine as many NeedsOwnCluster tests to bring down 
test run time


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

Branch: refs/heads/master
Commit: 2d27179b3fcfc7a8d2c8f7bad4a37b3071c81961
Parents: 7601d59
Author: James Taylor 
Authored: Tue Sep 20 18:39:05 2016 -0700
Committer: James Taylor 
Committed: Tue Sep 20 18:39:05 2016 -0700

--
 .../StatisticsCollectionRunTrackerIT.java   |  25 +-
 .../BaseOwnClusterClientManagedTimeIT.java  |  29 --
 .../BaseOwnClusterHBaseManagedTimeIT.java   |  29 --
 .../phoenix/end2end/BaseOwnClusterIT.java   |   7 +
 .../end2end/BaseTenantSpecificTablesIT.java |  87 +++---
 .../org/apache/phoenix/end2end/BaseViewIT.java  |  81 ++---
 .../end2end/CountDistinctCompressionIT.java |   2 +-
 .../phoenix/end2end/CsvBulkLoadToolIT.java  |   2 +-
 .../apache/phoenix/end2end/IndexExtendedIT.java |   2 +-
 .../org/apache/phoenix/end2end/KeyOnlyIT.java   | 127 +++-
 .../phoenix/end2end/MultiCfQueryExecIT.java | 306 ---
 .../phoenix/end2end/ParallelIteratorsIT.java| 112 +++
 .../phoenix/end2end/ParallelStatsEnabledIT.java |  16 +-
 .../apache/phoenix/end2end/QueryTimeoutIT.java  |   2 +-
 .../phoenix/end2end/QueryWithLimitIT.java   |  10 +-
 .../phoenix/end2end/QueryWithOffsetIT.java  |  78 ++---
 .../apache/phoenix/end2end/RenewLeaseIT.java|   2 +-
 .../phoenix/end2end/SpillableGroupByIT.java | 127 
 .../end2end/StatsCollectionDisabledIT.java  |  79 -
 .../end2end/StatsCollectorAbstractIT.java   |  77 -
 .../phoenix/end2end/StatsCollectorIT.java   | 161 +-
 .../StatsCollectorWithSplitsAndMultiCFIT.java   | 186 ---
 .../end2end/TenantSpecificTablesDDLIT.java  | 272 -
 .../end2end/TenantSpecificTablesDMLIT.java  | 269 ++--
 .../phoenix/end2end/TransactionalViewIT.java|  48 ++-
 .../org/apache/phoenix/end2end/UpgradeIT.java   | 104 ---
 .../phoenix/end2end/UserDefinedFunctionsIT.java |   7 +-
 .../java/org/apache/phoenix/end2end/ViewIT.java | 249 ---
 .../index/ImmutableIndexWithStatsIT.java|  26 +-
 .../end2end/index/MutableIndexFailureIT.java|   4 +-
 .../end2end/index/ReadOnlyIndexFailureIT.java   |   4 +-
 .../end2end/index/txn/TxWriteFailureIT.java |   4 +-
 .../apache/phoenix/execute/PartialCommitIT.java |   5 +
 .../RoundRobinResultIteratorWithStatsIT.java|   4 +-
 .../phoenix/monitoring/PhoenixMetricsIT.java|   4 +-
 .../apache/phoenix/rpc/PhoenixClientRpcIT.java  |   4 +-
 .../apache/phoenix/rpc/PhoenixServerRpcIT.java  |   4 +-
 .../org/apache/phoenix/util/MetaDataUtil.java   |   4 +
 .../java/org/apache/phoenix/query/BaseTest.java |   4 -
 .../java/org/apache/phoenix/util/TestUtil.java  |  17 +-
 pom.xml |   3 -
 41 files changed, 1105 insertions(+), 1478 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/2d27179b/phoenix-core/src/it/java/org/apache/phoenix/coprocessor/StatisticsCollectionRunTrackerIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/coprocessor/StatisticsCollectionRunTrackerIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/coprocessor/StatisticsCollectionRunTrackerIT.java
index bf567f0..bd88922 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/coprocessor/StatisticsCollectionRunTrackerIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/coprocessor/StatisticsCollectionRunTrackerIT.java
@@ -33,20 +33,26 @@ import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.phoenix.end2end.BaseOwnClusterHBaseManagedTimeIT;
+import org.apache.phoenix.end2end.ParallelStatsEnabledIT;
 import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.schema.stats.StatisticsCollectionRunTracker;
 import org.apache.phoenix.util.ReadOnlyProps;
+import org.apache.phoenix.util.SchemaUtil;
+import org.apache.phoenix.util.TestUtil;
 import org.junit.Assert;
+import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
 import com.google.common.collect.Maps;
 
-public class StatisticsCollectionRunTrackerIT extends 
BaseOwnClusterHBaseManagedTimeIT {
+public class StatisticsCollectionRunTrackerIT extends ParallelStatsEnabledIT {
 private static final StatisticsCollectionRunTracker tracker = 
StatisticsCollectionRunTracker
   

phoenix git commit: Fix test failures

2016-09-20 Thread samarth
Repository: phoenix
Updated Branches:
  refs/heads/encodecolumns 920be8fec -> 3e7aa0065


Fix test failures


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

Branch: refs/heads/encodecolumns
Commit: 3e7aa0065a856bb6e0c839da65d5855b219a65aa
Parents: 920be8f
Author: Samarth 
Authored: Tue Sep 20 16:00:04 2016 -0700
Committer: Samarth 
Committed: Tue Sep 20 16:00:04 2016 -0700

--
 .../src/main/java/org/apache/phoenix/schema/MetaDataClient.java| 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/3e7aa006/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
index 18176b9..3eca340 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
@@ -2086,7 +2086,7 @@ public class MetaDataClient {
 } else {
 storageScheme = StorageScheme.ENCODED_COLUMN_NAMES;
 }
-cqCounter = storageScheme != 
StorageScheme.ENCODED_COLUMN_NAMES ? new EncodedCQCounter() : NULL_COUNTER;
+cqCounter = storageScheme != 
StorageScheme.NON_ENCODED_COLUMN_NAMES ? new EncodedCQCounter() : NULL_COUNTER;
 }
 
 Map changedCqCounters = new 
HashMap<>(colDefs.size());



Build failed in Jenkins: Phoenix-4.x-HBase-1.1 #205

2016-09-20 Thread Apache Jenkins Server
See 

Changes:

[maryannxue] PHOENIX-3279 QueryPlan.iterator(ParallelScanGrouper scanGrouper) 
should

--
[...truncated 734 lines...]
at 
org.apache.phoenix.trace.PhoenixTracingEndToEndIT.testCustomAnnotationTracing(PhoenixTracingEndToEndIT.java:393)


Results :

Failed tests: 
  PhoenixTracingEndToEndIT.testClientServerIndexingTracing:233 Never found 
indexing updates
  PhoenixTracingEndToEndIT.testCustomAnnotationTracing:393 Get expected updates 
to trace table
  PhoenixTracingEndToEndIT.testScanTracing:290 Get expected updates to trace 
table
  PhoenixTracingEndToEndIT.testScanTracingOnServer:341 Get expected updates to 
trace table

Tests run: 1315, Failures: 4, Errors: 0, Skipped: 5

[INFO] 
[INFO] --- maven-failsafe-plugin:2.19.1:integration-test 
(ClientManagedTimeTests) @ phoenix-core ---

---
 T E S T S
---
Running org.apache.phoenix.end2end.ColumnProjectionOptimizationIT
Running org.apache.phoenix.end2end.CaseStatementIT
Running org.apache.phoenix.end2end.CastAndCoerceIT
Running org.apache.phoenix.end2end.ArrayIT
Running org.apache.phoenix.end2end.ClientTimeArithmeticQueryIT
Running org.apache.phoenix.end2end.CreateSchemaIT
Running org.apache.phoenix.end2end.AggregateQueryIT
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.476 sec - in 
org.apache.phoenix.end2end.CreateSchemaIT
Running org.apache.phoenix.end2end.CreateTableIT
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 25.578 sec - in 
org.apache.phoenix.end2end.ColumnProjectionOptimizationIT
Running org.apache.phoenix.end2end.CustomEntityDataIT
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 6.791 sec - in 
org.apache.phoenix.end2end.CustomEntityDataIT
Running org.apache.phoenix.end2end.DerivedTableIT
Tests run: 49, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 38.893 sec - 
in org.apache.phoenix.end2end.CastAndCoerceIT
Running org.apache.phoenix.end2end.DistinctCountIT
Tests run: 63, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 42.025 sec - 
in org.apache.phoenix.end2end.CaseStatementIT
Running org.apache.phoenix.end2end.DropSchemaIT
Tests run: 18, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 20.397 sec - 
in org.apache.phoenix.end2end.DerivedTableIT
Running org.apache.phoenix.end2end.ExtendedQueryExecIT
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 11.96 sec - in 
org.apache.phoenix.end2end.DropSchemaIT
Running org.apache.phoenix.end2end.FunkyNamesIT
Tests run: 10, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 19.735 sec - 
in org.apache.phoenix.end2end.DistinctCountIT
Running org.apache.phoenix.end2end.GroupByIT
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 6.63 sec - in 
org.apache.phoenix.end2end.ExtendedQueryExecIT
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 6.314 sec - in 
org.apache.phoenix.end2end.FunkyNamesIT
Running org.apache.phoenix.end2end.NotQueryIT
Tests run: 49, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 58.235 sec - 
in org.apache.phoenix.end2end.AggregateQueryIT
Running org.apache.phoenix.end2end.PointInTimeQueryIT
Running org.apache.phoenix.end2end.NativeHBaseTypesIT
Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 4.731 sec - in 
org.apache.phoenix.end2end.NativeHBaseTypesIT
Running org.apache.phoenix.end2end.ProductMetricsIT
Tests run: 14, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 23.748 sec - 
in org.apache.phoenix.end2end.PointInTimeQueryIT
Running org.apache.phoenix.end2end.QueryDatabaseMetaDataIT
Tests run: 79, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 87.266 sec - 
in org.apache.phoenix.end2end.ArrayIT
Running org.apache.phoenix.end2end.QueryIT
Tests run: 15, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 96.186 sec - 
in org.apache.phoenix.end2end.CreateTableIT
Running org.apache.phoenix.end2end.ReadIsolationLevelIT
Tests run: 61, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 28.433 sec - 
in org.apache.phoenix.end2end.ProductMetricsIT
Running org.apache.phoenix.end2end.RowValueConstructorIT
Tests run: 77, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 44.081 sec - 
in org.apache.phoenix.end2end.NotQueryIT
Running org.apache.phoenix.end2end.ScanQueryIT
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 6.532 sec - in 
org.apache.phoenix.end2end.ReadIsolationLevelIT
Running org.apache.phoenix.end2end.SequenceBulkAllocationIT
Tests run: 105, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 65.265 sec - 
in org.apache.phoenix.end2end.GroupByIT
Running org.apache.phoenix.end2end.SequenceIT
Tests run: 245, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 133.956 sec - 
in org.apache.phoenix.end2end.ClientTimeArithmeticQueryIT
Running org.apache.phoenix.end2end.ToNumberFunctionIT
Tests run: 56, Failures: 0, Errors: 0, Skippe

Build failed in Jenkins: Phoenix-Calcite #12

2016-09-20 Thread Apache Jenkins Server
See 

Changes:

[samarth] PHOENIX-2474 Cannot round to a negative precision (to the left of the

[samarth] PHOENIX-2793 Test case for date-time functions on null dates return no

[samarth] Implement DAYOFWEEK and DAYOFYEAR built-in functions (Prakul Agarwal)

[ankitsinghal59] PHOENIX-3054 Counting zero null rows returns an empty result 
set

[tdsilva] PHOENIX-2641 Implicit wildcard in LIKE predicate search pattern

[elserj] PHOENIX-3246 Treat U+2002 as whitespace in parser

[larsh] PHOENIX-2785 Do not store NULLs for immutable tables.

[jamestaylor] PHOENIX-2946 Projected comparison between date and timestamp 
columns

[jamestaylor] PHOENIX-3255 Increase test coverage for TIMESTAMP (Kevin Liew)

[larsh] PHOENIX-3228 Index tables should not be configured with a custom/smaller

[elserj] PHOENIX-3081 Consult RegionServer stopped/stopping state before logging

[samarth] PHOENIX-3230 Upgrade code running concurrently on different JVMs could

[samarth] PHOENIX-3260 MetadataRegionObserver.postOpen() can prevent region 
server

[samarth] PHOENIX-3230 Addendum to use the physical name of system catalog and

[tdsilva] PHOENIX-1367 VIEW derived from another VIEW doesn't use parent VIEW

[elserj] PHOENIX-3176 Remove unnecessary PQS proxy user authorization

[jamestaylor] PHOENIX-3046 NOT LIKE with wildcard unexpectedly returns results 
(Kevin

[rajeshbabu] PHOENIX-3170 Remove the futuretask from the list if

[jamestaylor] PHOENIX-3275 Reduce logging level of mutable secondary index 
logging

[jamestaylor] PHOENIX-3250 Remove static member variables to enable method-level

[ankitsinghal59] PHOENIX-3237 Automatic rebuild of disabled index will fail if 
indexes of

[rajeshbabu] PHOENIX-3162 TableNotFoundException might be thrown when an index

[jamestaylor] PHOENIX-3278 Remove usage of BaseTest.ensureTableCreated()

[elserj] PHOENIX-3072 Deadlock on region opening with secondary index recovery

[jamestaylor] PHOENIX-3253 Make changes in various classes for method level

[jamestaylor] PHOENIX-3280 Automatic attempt to rebuild all disabled index

[jamestaylor] PHOENIX-3286 Use regular queue depth instead of overriding it to 
zero

[jamestaylor] PHOENIX-3253 Make changes to BaseHBaseTimeManagedIT tests to 
support

[jamestaylor] PHOENIX-3249 Make changes in LocalIndexIT for method level

[jamestaylor] PHOENIX-3285 Add test name in Parameters name since failsafe uses 
that

[jamestaylor] PHOENIX-3291 Do not throw return value of Throwables#propagate 
call

[jamestaylor] PHOENIX-3290 Move and/or combine as many NeedsOwnCluster tests to 
bring

[jamestaylor] PHOENIX-3293 Create separate test categories for stats enabled and

[jamestaylor] PHOENIX-3268 Upgrade to Tephra 0.9.0

[samarth] PHOENIX-3174 Make minor upgrade a manual step

[samarth] PHOENIX-3302 Use unique names for views and indexes in

[maryannxue] PHOENIX-3279 QueryPlan.iterator(ParallelScanGrouper scanGrouper) 
should

--
[...truncated 9539 lines...]
  QueryCompilerTest.testNotOrderByOrderPreserving:1819 » SQL Error while 
executi...
  QueryCompilerTest.testNullInScanKey:498->compileQuery:450->getQueryPlan:464 » 
SQL
  
QueryCompilerTest.testOnlyNullInScanKey:510->compileQuery:450->getQueryPlan:464 
» SQL
  QueryCompilerTest.testOrderByOrderPreservingFwd:1775 » SQL Error while 
executi...
  QueryCompilerTest.testOrderByOrderPreservingRev:1800 » SQL Error while 
executi...
  QueryCompilerTest.testOrderByWithNoProjection:2313 » SQL Error while 
executing...
  
QueryCompilerTest.testPlanForOrderByOrGroupByNotUseRoundRobin:1960->testOrderByOrGroupByDoesntUseRoundRobin:1966
 » SQL
  QueryCompilerTest.testProjection:2272 » SQL Error while executing SQL "CREATE 
...
  
QueryCompilerTest.testRTrimSetScanKey:1033->compileQuery:450->getQueryPlan:464 
» SQL
  QueryCompilerTest.testRegex:1649 » SQL Error while executing SQL "CREATE 
TABLE...
  
QueryCompilerTest.testRegexpSubstrSetScanKeys:908->compileQuery:450->getQueryPlan:464
 » SQL
  QueryCompilerTest.testSaltTableJoin:2394 ClassCast 
org.apache.calcite.jdbc.Pho...
  QueryCompilerTest.testSelectColumnsInOneFamily:1994 » SQL Error while 
executin...
  QueryCompilerTest.testSelectColumnsInOneFamilyWithSchema:2014 » SQL Error 
whil...
  QueryCompilerTest.testServerArrayElementProjection1:2091 » SQL Error while 
exe...
  QueryCompilerTest.testServerArrayElementProjection2:2104 » SQL Error while 
exe...
  QueryCompilerTest.testServerArrayElementProjection3:2117 » SQL Error while 
exe...
  QueryCompilerTest.testServerArrayElementProjection4:2130 » SQL Error while 
exe...
  QueryCompilerTest.testServerArrayElementProjection5:2143 » SQL Error while 
exe...
  QueryCompilerTest.testServerArrayElementProjectionWithArrayPrimaryKey:2156 » 
SQL
  
QueryCompilerTest.testSubstrSetScanKey:1023->compileQuery:450->getQueryPlan:464 
» SQL
  QueryCompilerTest.testTableAliasMatchesCFName:779 » SQL Error while preparing 
...
  QueryCompilerTest.tes

[47/47] phoenix git commit: Fix sync conflicts

2016-09-20 Thread maryannxue
Fix sync conflicts


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

Branch: refs/heads/calcite
Commit: b612f16964e80b7ca97441e9b7183c80853bea01
Parents: b8c8a4f 7601d59
Author: maryannxue 
Authored: Tue Sep 20 11:05:09 2016 -0700
Committer: maryannxue 
Committed: Tue Sep 20 11:05:09 2016 -0700

--
 .../phoenix/end2end/AbsFunctionEnd2EndIT.java   |2 +-
 .../phoenix/end2end/AggregateQueryIT.java   |   36 +
 .../AlterMultiTenantTableWithViewsIT.java   |2 +-
 .../apache/phoenix/end2end/AlterSessionIT.java  |2 +-
 .../apache/phoenix/end2end/AlterTableIT.java|  705 +++
 .../phoenix/end2end/AlterTableWithViewsIT.java  |6 +-
 .../phoenix/end2end/AppendOnlySchemaIT.java |2 +-
 .../phoenix/end2end/ArithmeticQueryIT.java  |2 +-
 .../phoenix/end2end/ArrayAppendFunctionIT.java  |2 +-
 .../phoenix/end2end/ArrayConcatFunctionIT.java  |2 +-
 .../phoenix/end2end/ArrayFillFunctionIT.java|2 +-
 .../phoenix/end2end/ArrayPrependFunctionIT.java |2 +-
 .../end2end/ArrayToStringFunctionIT.java|   80 +-
 .../phoenix/end2end/ArraysWithNullsIT.java  |2 +-
 .../apache/phoenix/end2end/AutoCommitIT.java|2 +-
 .../phoenix/end2end/AutoPartitionViewsIT.java   |4 +-
 .../BaseHBaseManagedTimeTableReuseIT.java   |   73 -
 .../apache/phoenix/end2end/BaseParallelIT.java  |   69 +
 .../end2end/BaseTenantSpecificViewIndexIT.java  |2 +-
 .../org/apache/phoenix/end2end/BaseViewIT.java  |1 -
 .../apache/phoenix/end2end/BinaryRowKeyIT.java  |2 +-
 .../phoenix/end2end/CSVCommonsLoaderIT.java |2 +-
 .../apache/phoenix/end2end/CaseStatementIT.java |2 +-
 .../apache/phoenix/end2end/CastAndCoerceIT.java |2 +-
 .../phoenix/end2end/CbrtFunctionEnd2EndIT.java  |2 +-
 .../end2end/ClientTimeArithmeticQueryIT.java|2 +-
 .../phoenix/end2end/CoalesceFunctionIT.java |2 +-
 .../ConnectionQueryServicesTestImpl.java|   33 +-
 .../end2end/ConvertTimezoneFunctionIT.java  |2 +-
 .../phoenix/end2end/CsvBulkLoadToolIT.java  |6 +-
 .../org/apache/phoenix/end2end/DateTimeIT.java  |  761 ++-
 .../phoenix/end2end/DecodeFunctionIT.java   |2 +-
 .../org/apache/phoenix/end2end/DeleteIT.java|   12 +-
 .../apache/phoenix/end2end/DerivedTableIT.java  |   15 +-
 .../phoenix/end2end/DisableLocalIndexIT.java|4 +-
 .../phoenix/end2end/DistinctPrefixFilterIT.java |4 +-
 .../apache/phoenix/end2end/DropSchemaIT.java|2 +-
 .../apache/phoenix/end2end/DynamicColumnIT.java |2 +-
 .../apache/phoenix/end2end/DynamicFamilyIT.java |2 +-
 .../apache/phoenix/end2end/DynamicUpsertIT.java |   33 +-
 .../phoenix/end2end/EncodeFunctionIT.java   |2 +-
 .../phoenix/end2end/EvaluationOfORIT.java   |2 +-
 .../phoenix/end2end/ExecuteStatementsIT.java|2 +-
 .../phoenix/end2end/ExpFunctionEnd2EndIT.java   |2 +-
 .../phoenix/end2end/FirstValueFunctionIT.java   |2 +-
 .../end2end/GetSetByteBitFunctionEnd2EndIT.java |2 +-
 .../apache/phoenix/end2end/GroupByCaseIT.java   |   29 +-
 .../org/apache/phoenix/end2end/GroupByIT.java   |5 +-
 .../end2end/HBaseManagedTimeTableReuseTest.java |   47 -
 .../phoenix/end2end/HBaseManagedTimeTest.java   |2 +-
 .../apache/phoenix/end2end/HashJoinMoreIT.java  |   18 +-
 .../org/apache/phoenix/end2end/InListIT.java|2 +-
 .../phoenix/end2end/InMemoryOrderByIT.java  |2 +-
 .../apache/phoenix/end2end/IndexExtendedIT.java |  578 ++
 .../org/apache/phoenix/end2end/IndexToolIT.java |  257 ---
 .../apache/phoenix/end2end/InstrFunctionIT.java |2 +-
 .../org/apache/phoenix/end2end/IsNullIT.java|2 +-
 .../org/apache/phoenix/end2end/KeyOnlyIT.java   |5 +-
 .../phoenix/end2end/LastValueFunctionIT.java|2 +-
 .../phoenix/end2end/LikeExpressionIT.java   |  125 +-
 .../phoenix/end2end/LnLogFunctionEnd2EndIT.java |2 +-
 .../apache/phoenix/end2end/MD5FunctionIT.java   |2 +-
 .../org/apache/phoenix/end2end/MapReduceIT.java |2 +-
 .../phoenix/end2end/MappingTableDataTypeIT.java |2 +-
 .../end2end/MinMaxAggregateFunctionIT.java  |2 +-
 .../phoenix/end2end/ModulusExpressionIT.java|2 +-
 .../phoenix/end2end/MultiCfQueryExecIT.java |1 -
 .../phoenix/end2end/MutableIndexToolIT.java |  129 --
 .../end2end/NamespaceSchemaMappingIT.java   |2 +-
 .../org/apache/phoenix/end2end/NotQueryIT.java  |2 +-
 .../phoenix/end2end/NthValueFunctionIT.java |2 +-
 .../end2end/OctetLengthFunctionEnd2EndIT.java   |2 +-
 .../org/apache/phoenix/end2end/OrderByIT.java   |2 +-
 .../end2end/ParallelStatsDisabledIT.java|   30 +
 .../end2end/ParallelStatsDisabledTest

[12/47] phoenix git commit: PHOENIX-3081 Consult RegionServer stopped/stopping state before logging error in StatisticsScanner

2016-09-20 Thread maryannxue
PHOENIX-3081 Consult RegionServer stopped/stopping state before logging error 
in StatisticsScanner


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

Branch: refs/heads/calcite
Commit: 36d500cb83209cd10ae87c5cce6648aab2866925
Parents: fd6da35
Author: Josh Elser 
Authored: Mon Jul 18 16:24:22 2016 -0400
Committer: Josh Elser 
Committed: Thu Sep 8 17:27:07 2016 -0400

--
 .../phoenix/schema/stats/StatisticsScanner.java |  72 --
 .../schema/stats/StatisticsScannerTest.java | 144 +++
 2 files changed, 202 insertions(+), 14 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/36d500cb/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsScanner.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsScanner.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsScanner.java
index 082e833..736efc6 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsScanner.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsScanner.java
@@ -35,6 +35,7 @@ import org.apache.hadoop.hbase.client.Mutation;
 import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
 import org.apache.hadoop.hbase.regionserver.InternalScanner;
 import org.apache.hadoop.hbase.regionserver.Region;
+import org.apache.hadoop.hbase.regionserver.RegionServerServices;
 import org.apache.hadoop.hbase.regionserver.ScannerContext;
 import org.apache.phoenix.hbase.index.util.ImmutableBytesPtr;
 
@@ -49,12 +50,14 @@ public class StatisticsScanner implements InternalScanner {
 private StatisticsCollector tracker;
 private ImmutableBytesPtr family;
 private final Configuration config;
+private final RegionServerServices regionServerServices;
 
 public StatisticsScanner(StatisticsCollector tracker, StatisticsWriter 
stats, RegionCoprocessorEnvironment env,
 InternalScanner delegate, ImmutableBytesPtr family) {
 this.tracker = tracker;
 this.statsWriter = stats;
 this.delegate = delegate;
+this.regionServerServices = env.getRegionServerServices();
 this.region = env.getRegion();
 this.family = family;
 this.config = env.getConfiguration();
@@ -89,9 +92,13 @@ public class StatisticsScanner implements InternalScanner {
 
 @Override
 public void close() throws IOException {
-boolean async = config.getBoolean(COMMIT_STATS_ASYNC, 
DEFAULT_COMMIT_STATS_ASYNC);
-StatisticsCollectionRunTracker collectionTracker = 
StatisticsCollectionRunTracker.getInstance(config);
-StatisticsScannerCallable callable = new StatisticsScannerCallable();
+boolean async = getConfig().getBoolean(COMMIT_STATS_ASYNC, 
DEFAULT_COMMIT_STATS_ASYNC);
+StatisticsCollectionRunTracker collectionTracker = 
getStatsCollectionRunTracker(config);
+StatisticsScannerCallable callable = createCallable();
+if (getRegionServerServices().isStopping() || 
getRegionServerServices().isStopped()) {
+LOG.debug("Not updating table statistics because the server is 
stopping/stopped");
+return;
+}
 if (!async) {
 callable.call();
 } else {
@@ -99,12 +106,45 @@ public class StatisticsScanner implements InternalScanner {
 }
 }
 
-private class StatisticsScannerCallable implements Callable {
+// VisibleForTesting
+StatisticsCollectionRunTracker getStatsCollectionRunTracker(Configuration 
c) {
+return StatisticsCollectionRunTracker.getInstance(c);
+}
+
+Configuration getConfig() {
+return config;
+}
+
+StatisticsWriter getStatisticsWriter() {
+return statsWriter;
+}
+
+RegionServerServices getRegionServerServices() {
+return regionServerServices;
+}
+
+Region getRegion() {
+return region;
+}
+
+StatisticsScannerCallable createCallable() {
+return new StatisticsScannerCallable();
+}
+
+StatisticsCollector getTracker() {
+return tracker;
+}
+
+InternalScanner getDelegate() {
+return delegate;
+}
+
+class StatisticsScannerCallable implements Callable {
 @Override
 public Void call() throws IOException {
 IOException toThrow = null;
-StatisticsCollectionRunTracker collectionTracker = 
StatisticsCollectionRunTracker.getInstance(config);
-final HRegionInfo regionInfo = region.getRegionInfo();
+StatisticsColle

[13/47] phoenix git commit: PHOENIX-3230 Upgrade code running concurrently on different JVMs could make clients unusuable

2016-09-20 Thread maryannxue
PHOENIX-3230 Upgrade code running concurrently on different JVMs could make 
clients unusuable


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

Branch: refs/heads/calcite
Commit: df0d61179a97881b8b72595af198dbb346adfb9f
Parents: 36d500c
Author: Samarth 
Authored: Thu Sep 8 20:20:59 2016 -0700
Committer: Samarth 
Committed: Thu Sep 8 20:20:59 2016 -0700

--
 .../phoenix/coprocessor/MetaDataProtocol.java   |  20 +-
 .../phoenix/exception/SQLExceptionCode.java |   1 +
 .../query/ConnectionQueryServicesImpl.java  | 244 +++
 .../apache/phoenix/query/QueryConstants.java|   1 +
 .../org/apache/phoenix/util/UpgradeUtil.java|   5 +-
 5 files changed, 164 insertions(+), 107 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/df0d6117/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
index dce89bd..20922e5 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
@@ -19,9 +19,9 @@ package org.apache.phoenix.coprocessor;
 
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
+import java.util.NavigableMap;
+import java.util.TreeMap;
 
 import org.apache.hadoop.hbase.util.ByteStringer;
 import org.apache.phoenix.coprocessor.generated.MetaDataProtos;
@@ -29,7 +29,6 @@ import 
org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataResponse;
 import org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataService;
 import org.apache.phoenix.coprocessor.generated.PFunctionProtos;
 import org.apache.phoenix.hbase.index.util.VersionUtil;
-import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
 import org.apache.phoenix.parse.PFunction;
 import org.apache.phoenix.parse.PSchema;
 import org.apache.phoenix.schema.PColumn;
@@ -64,7 +63,7 @@ import com.google.protobuf.ByteString;
 public abstract class MetaDataProtocol extends MetaDataService {
 public static final int PHOENIX_MAJOR_VERSION = 4;
 public static final int PHOENIX_MINOR_VERSION = 8;
-public static final int PHOENIX_PATCH_NUMBER = 0;
+public static final int PHOENIX_PATCH_NUMBER = 1;
 public static final int PHOENIX_VERSION =
 VersionUtil.encodeVersion(PHOENIX_MAJOR_VERSION, 
PHOENIX_MINOR_VERSION, PHOENIX_PATCH_NUMBER);
 
@@ -89,7 +88,7 @@ public abstract class MetaDataProtocol extends 
MetaDataService {
 
 // ALWAYS update this map whenever rolling out a new release (major, minor 
or patch release). 
 // Key is the SYSTEM.CATALOG timestamp for the version and value is the 
version string.
-public static final Map TIMESTAMP_VERSION_MAP = new 
HashMap<>(10);
+private static final NavigableMap TIMESTAMP_VERSION_MAP = 
new TreeMap<>();
 static {
 TIMESTAMP_VERSION_MAP.put(MIN_SYSTEM_TABLE_TIMESTAMP_4_1_0, "4.1.x");
 TIMESTAMP_VERSION_MAP.put(MIN_SYSTEM_TABLE_TIMESTAMP_4_2_0, "4.2.0");
@@ -100,6 +99,7 @@ public abstract class MetaDataProtocol extends 
MetaDataService {
 TIMESTAMP_VERSION_MAP.put(MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0, "4.7.x");
 TIMESTAMP_VERSION_MAP.put(MIN_SYSTEM_TABLE_TIMESTAMP_4_8_0, "4.8.x");
 }
+
 public static final String CURRENT_CLIENT_VERSION = PHOENIX_MAJOR_VERSION 
+ "." + PHOENIX_MINOR_VERSION + "." + PHOENIX_PATCH_NUMBER; 
 
 // TODO: pare this down to minimum, as we don't need duplicates for both 
table and column errors, nor should we need
@@ -401,4 +401,14 @@ public abstract class MetaDataProtocol extends 
MetaDataService {
 return schema;
 }
 }
+  
+public static String getVersion(long serverTimestamp) {
+/*
+ * It is possible that when clients are trying to run upgrades 
concurrently, we could be at an intermediate
+ * server timestamp. Using floorKey provides us a range based lookup 
where the timestamp range for a release is
+ * [timeStampForRelease, timestampForNextRelease).
+ */
+String version = 
TIMESTAMP_VERSION_MAP.get(TIMESTAMP_VERSION_MAP.floorKey(serverTimestamp));
+return version;
+}
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/df0d6117/phoenix-core/src/main/java/org/apache/phoenix/exception/SQLExceptionCode.java

[40/47] phoenix git commit: PHOENIX-3293 Create separate test categories for stats enabled and disabled

2016-09-20 Thread maryannxue
http://git-wip-us.apache.org/repos/asf/phoenix/blob/6b868392/phoenix-core/src/it/java/org/apache/phoenix/end2end/SerialIteratorsIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SerialIteratorsIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SerialIteratorsIT.java
index d4c71af..0494342 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SerialIteratorsIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SerialIteratorsIT.java
@@ -37,7 +37,7 @@ import org.junit.Test;
 
 import com.google.common.collect.Maps;
 
-public class SerialIteratorsIT extends BaseHBaseManagedTimeTableReuseIT {
+public class SerialIteratorsIT extends ParallelStatsDisabledIT {
 private String tableName = generateRandomString();
 private final String[] strings = { "a", "b", "c", "d", "e", "f", "g", "h", 
"i", "j", "k", "l", "m", "n", "o", "p",
 "q", "r", "s", "t", "u", "v", "w", "x", "y", "z" };

http://git-wip-us.apache.org/repos/asf/phoenix/blob/6b868392/phoenix-core/src/it/java/org/apache/phoenix/end2end/ServerExceptionIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ServerExceptionIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ServerExceptionIT.java
index e4f3c1d..bf2e933 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ServerExceptionIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ServerExceptionIT.java
@@ -32,7 +32,7 @@ import org.apache.phoenix.util.PropertiesUtil;
 import org.junit.Test;
 
 
-public class ServerExceptionIT extends BaseHBaseManagedTimeTableReuseIT {
+public class ServerExceptionIT extends ParallelStatsDisabledIT {
 
 @Test
 public void testServerExceptionBackToClient() throws Exception {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/6b868392/phoenix-core/src/it/java/org/apache/phoenix/end2end/SignFunctionEnd2EndIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SignFunctionEnd2EndIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SignFunctionEnd2EndIT.java
index 5c86955..3cc8041 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SignFunctionEnd2EndIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SignFunctionEnd2EndIT.java
@@ -36,7 +36,7 @@ import org.junit.Test;
  * End to end tests for {@link SignFunction}
  * @since 4.0.0
  */
-public class SignFunctionEnd2EndIT extends BaseHBaseManagedTimeTableReuseIT {
+public class SignFunctionEnd2EndIT extends ParallelStatsDisabledIT {
 
 private static final String KEY = "key";
 private static final String TEST_SIGNED = generateRandomString();

http://git-wip-us.apache.org/repos/asf/phoenix/blob/6b868392/phoenix-core/src/it/java/org/apache/phoenix/end2end/SkipScanAfterManualSplitIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SkipScanAfterManualSplitIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SkipScanAfterManualSplitIT.java
index 39ba19e..d4dd088 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SkipScanAfterManualSplitIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SkipScanAfterManualSplitIT.java
@@ -43,7 +43,7 @@ import org.junit.Test;
 import com.google.common.collect.Maps;
 
 
-public class SkipScanAfterManualSplitIT extends 
BaseHBaseManagedTimeTableReuseIT {
+public class SkipScanAfterManualSplitIT extends ParallelStatsDisabledIT {
 
 private static final int BATCH_SIZE = 25;
 private static final int MAX_FILESIZE = 1024 * 10;
@@ -60,7 +60,7 @@ public class SkipScanAfterManualSplitIT extends 
BaseHBaseManagedTimeTableReuseIT
 private static final int MAX_CHAR = 'z';
 
 @BeforeClass
-@Shadower(classBeingShadowed = BaseHBaseManagedTimeTableReuseIT.class)
+@Shadower(classBeingShadowed = ParallelStatsDisabledIT.class)
 public static void doSetup() throws Exception {
 Map props = Maps.newHashMapWithExpectedSize(2);
 // needed for 64 region parallelization due to splitting

http://git-wip-us.apache.org/repos/asf/phoenix/blob/6b868392/phoenix-core/src/it/java/org/apache/phoenix/end2end/SkipScanQueryIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SkipScanQueryIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SkipScanQueryIT.java
index 944acf7..17df5ba 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SkipScanQueryIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SkipScanQueryIT.java
@@ -41,7 +41,7 @@ import org.apache.phoenix.util.PhoenixRuntime;
 import org.junit.Test;
 
 
-public class 

[05/47] phoenix git commit: PHOENIX-2641 Implicit wildcard in LIKE predicate search pattern

2016-09-20 Thread maryannxue
PHOENIX-2641 Implicit wildcard in LIKE predicate search pattern

This closes #200


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

Branch: refs/heads/calcite
Commit: c02d6cb5971f7b17bcd5e308952fa081e32adf19
Parents: 7827178
Author: kliewkliew 
Authored: Wed Aug 24 06:40:35 2016 -0700
Committer: Thomas D'Silva 
Committed: Tue Sep 6 11:11:38 2016 -0700

--
 .../phoenix/end2end/LikeExpressionIT.java   | 23 
 .../phoenix/compile/ExpressionCompiler.java | 10 +++--
 .../phoenix/expression/LikeExpressionTest.java  |  6 +
 3 files changed, 37 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/c02d6cb5/phoenix-core/src/it/java/org/apache/phoenix/end2end/LikeExpressionIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/LikeExpressionIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/LikeExpressionIT.java
index 6bfa358..f97e1d7 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/LikeExpressionIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/LikeExpressionIT.java
@@ -182,4 +182,27 @@ public class LikeExpressionIT extends 
BaseHBaseManagedTimeTableReuseIT {
 "SELECT * FROM " + t + " WHERE k like 'AA_'");
 assertFalse(rs.next());
 }
+
+@Test
+public void testOneChar() throws Exception {
+Connection conn = DriverManager.getConnection(getUrl());
+String t = generateRandomString();
+String ddl = "CREATE TABLE " + t + " (k VARCHAR NOT NULL PRIMARY KEY)";
+conn.createStatement().execute(ddl);
+conn.createStatement().execute("UPSERT INTO " + t + " VALUES('A')");
+conn.createStatement().execute("UPSERT INTO " + t + " VALUES('AA')");
+conn.commit();
+
+ResultSet rs = conn.createStatement().executeQuery(
+"SELECT * FROM " + t + " WHERE k like '_'");
+assertTrue(rs.next());
+assertEquals("A", rs.getString(1));
+assertFalse(rs.next());
+
+rs = conn.createStatement().executeQuery(
+"SELECT * FROM " + t + " WHERE k like '_A'");
+assertTrue(rs.next());
+assertEquals("AA", rs.getString(1));
+assertFalse(rs.next());
+}
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/c02d6cb5/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java 
b/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java
index 0fd1876..aaab763 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java
@@ -136,6 +136,7 @@ import org.apache.phoenix.schema.types.PhoenixArray;
 import org.apache.phoenix.util.ExpressionUtil;
 import org.apache.phoenix.util.IndexUtil;
 import org.apache.phoenix.util.SchemaUtil;
+import org.apache.phoenix.util.StringUtil;
 
 
 public class ExpressionCompiler extends 
UnsupportedAllParseNodeVisitor {
@@ -517,8 +518,13 @@ public class ExpressionCompiler extends 
UnsupportedAllParseNodeVisitorhttp://git-wip-us.apache.org/repos/asf/phoenix/blob/c02d6cb5/phoenix-core/src/test/java/org/apache/phoenix/expression/LikeExpressionTest.java
--
diff --git 
a/phoenix-core/src/test/java/org/apache/phoenix/expression/LikeExpressionTest.java
 
b/phoenix-core/src/test/java/org/apache/phoenix/expression/LikeExpressionTest.java
index 580ac8e..2e33e7b 100644
--- 
a/phoenix-core/src/test/java/org/apache/phoenix/expression/LikeExpressionTest.java
+++ 
b/phoenix-core/src/test/java/org/apache/phoenix/expression/LikeExpressionTest.java
@@ -77,6 +77,12 @@ public class LikeExpressionTest {
 }
 
 @Test
+public void testOneChar() throws Exception {
+assertEquals(Boolean.TRUE, testExpression ("A", "_"));
+assertEquals(Boolean.FALSE, testExpression ("AA", "_"));
+}
+
+@Test
 public void testEmptySourceStr() throws Exception {
 assertEquals(Boolean.TRUE, testExpression ("", "%"));
 assertEquals(Boolean.FALSE, testExpression ("", "_"));



[18/47] phoenix git commit: PHOENIX-3046 NOT LIKE with wildcard unexpectedly returns results (Kevin Liew)

2016-09-20 Thread maryannxue
PHOENIX-3046 NOT LIKE with wildcard unexpectedly returns results (Kevin Liew)


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

Branch: refs/heads/calcite
Commit: 47a2b2c3ec1fb7a5ae3fc42c79a2199ab5108f44
Parents: c3cdb2a
Author: James Taylor 
Authored: Mon Sep 12 09:54:10 2016 -0700
Committer: James Taylor 
Committed: Mon Sep 12 11:46:58 2016 -0700

--
 .../phoenix/end2end/LikeExpressionIT.java   | 100 ++-
 .../phoenix/compile/ExpressionCompiler.java |  24 ++---
 2 files changed, 103 insertions(+), 21 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/47a2b2c3/phoenix-core/src/it/java/org/apache/phoenix/end2end/LikeExpressionIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/LikeExpressionIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/LikeExpressionIT.java
index f97e1d7..2fcee45 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/LikeExpressionIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/LikeExpressionIT.java
@@ -96,16 +96,16 @@ public class LikeExpressionIT extends 
BaseHBaseManagedTimeTableReuseIT {
 Connection conn = DriverManager.getConnection(getUrl());
 String table = generateRandomString();
 String ddl = "CREATE TABLE " + table
-+ " (k1 VARCHAR, k2 VARCHAR, CONSTRAINT pk PRIMARY KEY (k1,k2))";
++ " (k1 VARCHAR, k2 VARCHAR, CONSTRAINT pk PRIMARY KEY 
(k1,k2))";
 conn.createStatement().execute(ddl);
 conn.createStatement().execute("UPSERT INTO " + table + " 
VALUES('aa','bb')");
 conn.createStatement().execute("UPSERT INTO " + table + " 
VALUES('ab','bc')");
 conn.createStatement().execute("UPSERT INTO " + table + " 
VALUES(null,'cc')");
 conn.createStatement().execute("UPSERT INTO " + table + " 
VALUES('dd',null)");
 conn.commit();
-
+
 ResultSet rs = conn.createStatement().executeQuery(
-"SELECT * FROM " + table + " WHERE k1 LIKE '%'");
+"SELECT * FROM " + table + " WHERE k1 LIKE '%'");
 assertTrue(rs.next());
 assertEquals("aa", rs.getString(1));
 assertEquals("bb", rs.getString(2));
@@ -116,7 +116,7 @@ public class LikeExpressionIT extends 
BaseHBaseManagedTimeTableReuseIT {
 assertEquals("dd", rs.getString(1));
 assertEquals(null, rs.getString(2));
 assertFalse(rs.next());
-
+
 rs = conn.createStatement().executeQuery("SELECT * FROM " + table + " 
WHERE k2 LIKE '%'");
 assertTrue(rs.next());
 assertEquals(null, rs.getString(1));
@@ -128,7 +128,25 @@ public class LikeExpressionIT extends 
BaseHBaseManagedTimeTableReuseIT {
 assertEquals("ab", rs.getString(1));
 assertEquals("bc", rs.getString(2));
 assertFalse(rs.next());
-
+
+rs = conn.createStatement().executeQuery("SELECT * FROM " + table + " 
WHERE k2 LIKE '%%'");
+assertTrue(rs.next());
+assertEquals(null, rs.getString(1));
+assertEquals("cc", rs.getString(2));
+assertTrue(rs.next());
+assertEquals("aa", rs.getString(1));
+assertEquals("bb", rs.getString(2));
+assertTrue(rs.next());
+assertEquals("ab", rs.getString(1));
+assertEquals("bc", rs.getString(2));
+assertFalse(rs.next());
+
+rs = conn.createStatement().executeQuery("SELECT * FROM " + table + " 
WHERE k2 NOT LIKE '%'");
+assertFalse(rs.next());
+
+rs = conn.createStatement().executeQuery("SELECT * FROM " + table + " 
WHERE k2 NOT LIKE '%%'");
+assertFalse(rs.next());
+
 conn.close();
 }
 
@@ -205,4 +223,76 @@ public class LikeExpressionIT extends 
BaseHBaseManagedTimeTableReuseIT {
 assertEquals("AA", rs.getString(1));
 assertFalse(rs.next());
 }
+
+@Test
+public void testNull() throws Exception {
+Connection conn = DriverManager.getConnection(getUrl());
+String table = generateRandomString();
+String ddl = "CREATE TABLE " + table
++ " (pk INTEGER PRIMARY KEY, str VARCHAR)";
+conn.createStatement().execute(ddl);
+conn.createStatement().execute("UPSERT INTO " + table + " 
VALUES(0,'aa')");
+conn.createStatement().execute("UPSERT INTO " + table + " VALUES(1, 
null)");
+conn.commit();
+
+ResultSet rs = conn.createStatement().executeQuery(
+"SELECT str LIKE '%' FROM " + table);
+assertTrue(rs.next());
+assertEquals(true, rs.getBoolean

[30/47] phoenix git commit: PHOENIX-3286 Use regular queue depth instead of overriding it to zero for tests

2016-09-20 Thread maryannxue
PHOENIX-3286 Use regular queue depth instead of overriding it to zero for tests


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

Branch: refs/heads/calcite
Commit: a4ebcfdd262dcc311f96a80c3dd47290bce2c236
Parents: 2a223ad
Author: James Taylor 
Authored: Thu Sep 15 15:52:06 2016 -0700
Committer: James Taylor 
Committed: Thu Sep 15 15:52:06 2016 -0700

--
 .../java/org/apache/phoenix/query/QueryServicesTestImpl.java | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/a4ebcfdd/phoenix-core/src/test/java/org/apache/phoenix/query/QueryServicesTestImpl.java
--
diff --git 
a/phoenix-core/src/test/java/org/apache/phoenix/query/QueryServicesTestImpl.java
 
b/phoenix-core/src/test/java/org/apache/phoenix/query/QueryServicesTestImpl.java
index 6ae655c..f2b1519 100644
--- 
a/phoenix-core/src/test/java/org/apache/phoenix/query/QueryServicesTestImpl.java
+++ 
b/phoenix-core/src/test/java/org/apache/phoenix/query/QueryServicesTestImpl.java
@@ -33,8 +33,7 @@ import org.apache.phoenix.util.ReadOnlyProps;
  */
 public final class QueryServicesTestImpl extends BaseQueryServicesImpl {
 
-private static final int DEFAULT_THREAD_POOL_SIZE = 20;
-private static final int DEFAULT_QUEUE_SIZE = 0;
+private static final int DEFAULT_THREAD_POOL_SIZE = 10;
 // TODO: setting this down to 5mb causes insufficient memory exceptions. 
Need to investigate why
 private static final int DEFAULT_MAX_MEMORY_PERC = 30; // 30% of heap
 private static final int DEFAULT_THREAD_TIMEOUT_MS = 6*5; //5min
@@ -85,7 +84,6 @@ public final class QueryServicesTestImpl extends 
BaseQueryServicesImpl {
.setSequenceSaltBuckets(DEFAULT_SEQUENCE_TABLE_SALT_BUCKETS)
 .setMinStatsUpdateFrequencyMs(DEFAULT_MIN_STATS_UPDATE_FREQ_MS)
 .setThreadPoolSize(DEFAULT_THREAD_POOL_SIZE)
-.setQueueSize(DEFAULT_QUEUE_SIZE)
 .setMaxMemoryPerc(DEFAULT_MAX_MEMORY_PERC)
 .setThreadTimeoutMs(DEFAULT_THREAD_TIMEOUT_MS)
 .setSpoolThresholdBytes(DEFAULT_SPOOL_THRESHOLD_BYTES)



[41/47] phoenix git commit: PHOENIX-3293 Create separate test categories for stats enabled and disabled

2016-09-20 Thread maryannxue
PHOENIX-3293 Create separate test categories for stats enabled and disabled


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

Branch: refs/heads/calcite
Commit: 6b868392b1ac4c9729d3e9510eb8f9784f5d6a62
Parents: 14d16c8
Author: James Taylor 
Authored: Sat Sep 17 15:20:01 2016 -0700
Committer: James Taylor 
Committed: Sat Sep 17 15:20:01 2016 -0700

--
 .../phoenix/end2end/AbsFunctionEnd2EndIT.java   |  2 +-
 .../AlterMultiTenantTableWithViewsIT.java   |  2 +-
 .../apache/phoenix/end2end/AlterSessionIT.java  |  2 +-
 .../apache/phoenix/end2end/AlterTableIT.java|  2 +-
 .../phoenix/end2end/AlterTableWithViewsIT.java  |  4 +-
 .../phoenix/end2end/AppendOnlySchemaIT.java |  2 +-
 .../phoenix/end2end/ArithmeticQueryIT.java  |  2 +-
 .../phoenix/end2end/ArrayAppendFunctionIT.java  |  2 +-
 .../phoenix/end2end/ArrayConcatFunctionIT.java  |  2 +-
 .../phoenix/end2end/ArrayFillFunctionIT.java|  2 +-
 .../phoenix/end2end/ArrayPrependFunctionIT.java |  2 +-
 .../end2end/ArrayToStringFunctionIT.java|  2 +-
 .../phoenix/end2end/ArraysWithNullsIT.java  |  2 +-
 .../apache/phoenix/end2end/AutoCommitIT.java|  2 +-
 .../phoenix/end2end/AutoPartitionViewsIT.java   |  2 +-
 .../BaseHBaseManagedTimeTableReuseIT.java   | 70 
 .../apache/phoenix/end2end/BaseParallelIT.java  | 69 
 .../end2end/BaseTenantSpecificViewIndexIT.java  |  2 +-
 .../apache/phoenix/end2end/BinaryRowKeyIT.java  |  2 +-
 .../phoenix/end2end/CSVCommonsLoaderIT.java |  2 +-
 .../phoenix/end2end/CbrtFunctionEnd2EndIT.java  |  2 +-
 .../phoenix/end2end/CoalesceFunctionIT.java |  2 +-
 .../end2end/ConvertTimezoneFunctionIT.java  |  2 +-
 .../org/apache/phoenix/end2end/DateTimeIT.java  |  2 +-
 .../phoenix/end2end/DecodeFunctionIT.java   |  2 +-
 .../org/apache/phoenix/end2end/DeleteIT.java|  2 +-
 .../phoenix/end2end/DisableLocalIndexIT.java|  4 +-
 .../phoenix/end2end/DistinctPrefixFilterIT.java |  4 +-
 .../apache/phoenix/end2end/DynamicColumnIT.java |  2 +-
 .../apache/phoenix/end2end/DynamicFamilyIT.java |  2 +-
 .../apache/phoenix/end2end/DynamicUpsertIT.java |  2 +-
 .../phoenix/end2end/EncodeFunctionIT.java   |  2 +-
 .../phoenix/end2end/EvaluationOfORIT.java   |  2 +-
 .../phoenix/end2end/ExecuteStatementsIT.java|  2 +-
 .../phoenix/end2end/ExpFunctionEnd2EndIT.java   |  2 +-
 .../phoenix/end2end/FirstValueFunctionIT.java   |  2 +-
 .../end2end/GetSetByteBitFunctionEnd2EndIT.java |  2 +-
 .../apache/phoenix/end2end/GroupByCaseIT.java   |  2 +-
 .../end2end/HBaseManagedTimeTableReuseTest.java | 47 ---
 .../phoenix/end2end/HBaseManagedTimeTest.java   |  2 +-
 .../apache/phoenix/end2end/HashJoinMoreIT.java  |  4 +-
 .../org/apache/phoenix/end2end/InListIT.java|  2 +-
 .../phoenix/end2end/InMemoryOrderByIT.java  |  2 +-
 .../apache/phoenix/end2end/InstrFunctionIT.java |  2 +-
 .../org/apache/phoenix/end2end/IsNullIT.java|  2 +-
 .../phoenix/end2end/LastValueFunctionIT.java|  2 +-
 .../phoenix/end2end/LikeExpressionIT.java   |  2 +-
 .../phoenix/end2end/LnLogFunctionEnd2EndIT.java |  2 +-
 .../apache/phoenix/end2end/MD5FunctionIT.java   |  2 +-
 .../org/apache/phoenix/end2end/MapReduceIT.java |  2 +-
 .../phoenix/end2end/MappingTableDataTypeIT.java |  2 +-
 .../end2end/MinMaxAggregateFunctionIT.java  |  2 +-
 .../phoenix/end2end/ModulusExpressionIT.java|  2 +-
 .../end2end/NamespaceSchemaMappingIT.java   |  2 +-
 .../phoenix/end2end/NthValueFunctionIT.java |  2 +-
 .../end2end/OctetLengthFunctionEnd2EndIT.java   |  2 +-
 .../org/apache/phoenix/end2end/OrderByIT.java   |  2 +-
 .../end2end/ParallelStatsDisabledIT.java| 30 +++
 .../end2end/ParallelStatsDisabledTest.java  | 45 ++
 .../phoenix/end2end/ParallelStatsEnabledIT.java | 31 +++
 .../end2end/ParallelStatsEnabledTest.java   | 45 ++
 .../apache/phoenix/end2end/PercentileIT.java|  2 +-
 .../phoenix/end2end/PhoenixRuntimeIT.java   |  2 +-
 .../phoenix/end2end/PowerFunctionEnd2EndIT.java |  2 +-
 .../apache/phoenix/end2end/PrimitiveTypeIT.java |  2 +-
 .../phoenix/end2end/QueryExecWithoutSCNIT.java  |  2 +-
 .../org/apache/phoenix/end2end/QueryMoreIT.java |  2 +-
 .../apache/phoenix/end2end/RTrimFunctionIT.java |  2 +-
 .../org/apache/phoenix/end2end/ReadOnlyIT.java  |  2 +-
 .../end2end/RegexpReplaceFunctionIT.java|  2 +-
 .../phoenix/end2end/RegexpSplitFunctionIT.java  |  2 +-
 .../phoenix/end2end/RegexpSubstrFunctionIT.java |  2 +-
 .../phoenix/end2end/ReverseFunctionIT.java  |  2 +-
 .../apache/phoenix/end2end/ReverseScanIT.java   |  2 +-
 .../phoenix/end2end/RoundFloorCeilFuncIT.java   |  2 +-
 .../phoenix/end2end/

[38/47] phoenix git commit: PHOENIX-3290 Move and/or combine as many NeedsOwnCluster tests to bring down test run time

2016-09-20 Thread maryannxue
PHOENIX-3290 Move and/or combine as many NeedsOwnCluster tests to bring down 
test run time


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

Branch: refs/heads/calcite
Commit: 14d16c8534f8807680b345bcb1b47fa4d03e522c
Parents: 553a587
Author: James Taylor 
Authored: Sat Sep 17 00:05:06 2016 -0700
Committer: James Taylor 
Committed: Sat Sep 17 00:07:28 2016 -0700

--
 .../apache/phoenix/end2end/AlterTableIT.java| 705 ++-
 .../org/apache/phoenix/end2end/BaseViewIT.java  |   1 -
 .../phoenix/end2end/CsvBulkLoadToolIT.java  |   6 +-
 .../apache/phoenix/end2end/IndexExtendedIT.java | 578 +++
 .../org/apache/phoenix/end2end/IndexToolIT.java | 257 ---
 .../org/apache/phoenix/end2end/KeyOnlyIT.java   |   5 +-
 .../phoenix/end2end/MultiCfQueryExecIT.java |   1 -
 .../phoenix/end2end/MutableIndexToolIT.java | 129 
 .../phoenix/end2end/RoundFloorCeilFuncIT.java   | 683 ++
 .../RoundFloorCeilFunctionsEnd2EndIT.java   | 686 --
 .../phoenix/end2end/TransactionalViewIT.java|   5 +-
 .../org/apache/phoenix/end2end/UnionAllIT.java  | 288 
 .../index/ImmutableIndexWithStatsIT.java|   5 +-
 .../end2end/index/IndexOnOwnClusterIT.java  | 324 -
 .../org/apache/phoenix/tx/TransactionIT.java|   8 +-
 .../java/org/apache/phoenix/query/BaseTest.java |  30 -
 16 files changed, 1802 insertions(+), 1909 deletions(-)
--




[24/47] phoenix git commit: PHOENIX-3278 Remove usage of BaseTest.ensureTableCreated()

2016-09-20 Thread maryannxue
PHOENIX-3278 Remove usage of BaseTest.ensureTableCreated()


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

Branch: refs/heads/calcite
Commit: 7af708873c0b4457eb6598fb41fd279672fe0029
Parents: e4fd039
Author: James Taylor 
Authored: Wed Sep 14 09:31:00 2016 -0700
Committer: James Taylor 
Committed: Wed Sep 14 09:45:30 2016 -0700

--
 .../BaseHBaseManagedTimeTableReuseIT.java   |  3 --
 .../ConnectionQueryServicesTestImpl.java| 30 +++
 .../apache/phoenix/end2end/DynamicUpsertIT.java | 31 ++--
 .../apache/phoenix/end2end/GroupByCaseIT.java   | 27 +-
 .../apache/phoenix/end2end/HashJoinMoreIT.java  | 14 --
 .../apache/phoenix/end2end/PercentileIT.java| 29 +--
 .../end2end/QueryDatabaseMetaDataIT.java|  9 ++--
 .../org/apache/phoenix/end2end/QueryMoreIT.java |  6 +--
 .../end2end/RegexpReplaceFunctionIT.java|  4 +-
 .../phoenix/end2end/RegexpSubstrFunctionIT.java |  4 +-
 .../apache/phoenix/end2end/SkipScanQueryIT.java |  2 +-
 .../org/apache/phoenix/end2end/SortOrderIT.java |  9 +++-
 .../phoenix/end2end/SpillableGroupByIT.java | 21 +---
 .../end2end/index/IndexExpressionIT.java| 47 ++---
 .../apache/phoenix/end2end/index/IndexIT.java   |  4 +-
 .../phoenix/end2end/index/IndexMetadataIT.java  | 26 ++
 .../phoenix/end2end/index/MutableIndexIT.java   |  2 +-
 .../org/apache/phoenix/rpc/UpdateCacheIT.java   |  9 ++--
 .../phoenix/rpc/UpdateCacheWithScnIT.java   | 12 -
 .../org/apache/phoenix/tx/TransactionIT.java| 53 +++-
 .../apache/phoenix/jdbc/PhoenixTestDriver.java  |  2 +-
 .../java/org/apache/phoenix/query/BaseTest.java | 52 +++
 .../java/org/apache/phoenix/util/TestUtil.java  | 29 +++
 23 files changed, 208 insertions(+), 217 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/7af70887/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseHBaseManagedTimeTableReuseIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseHBaseManagedTimeTableReuseIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseHBaseManagedTimeTableReuseIT.java
index c40ec59..b09984b 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseHBaseManagedTimeTableReuseIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseHBaseManagedTimeTableReuseIT.java
@@ -18,8 +18,6 @@
 
 package org.apache.phoenix.end2end;
 
-import javax.annotation.concurrent.NotThreadSafe;
-
 import org.apache.hadoop.conf.Configuration;
 import org.apache.phoenix.query.BaseTest;
 import org.apache.phoenix.util.ReadOnlyProps;
@@ -45,7 +43,6 @@ import org.junit.experimental.categories.Category;
  *
  * @since 0.1
  */
-@NotThreadSafe
 @Category(HBaseManagedTimeTableReuseTest.class)
 public class BaseHBaseManagedTimeTableReuseIT extends BaseTest {
 protected static Configuration getTestClusterConfig() {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/7af70887/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConnectionQueryServicesTestImpl.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConnectionQueryServicesTestImpl.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConnectionQueryServicesTestImpl.java
index 2d0ed60..48f392b 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConnectionQueryServicesTestImpl.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConnectionQueryServicesTestImpl.java
@@ -49,39 +49,23 @@ public class ConnectionQueryServicesTestImpl extends 
ConnectionQueryServicesImpl
 }
 
 @Override
-public void addConnection(PhoenixConnection connection) throws 
SQLException {
+public synchronized void addConnection(PhoenixConnection connection) 
throws SQLException {
 connections.add(connection);
 }
 
 @Override
-public void removeConnection(PhoenixConnection connection) throws 
SQLException {
+public synchronized void removeConnection(PhoenixConnection connection) 
throws SQLException {
 connections.remove(connection);
 }
 
 @Override
-public void init(String url, Properties props) throws SQLException {
-try {
-super.init(url, props);
-/**
- * Clear the server-side meta data cache on initialization. 
Otherwise, if we
- * query for meta data tables, we'll get nothing (since the server 
just came
- * up). However, our server-si

[11/47] phoenix git commit: PHOENIX-3228 Index tables should not be configured with a custom/smaller MAX_FILESIZE.

2016-09-20 Thread maryannxue
PHOENIX-3228 Index tables should not be configured with a custom/smaller 
MAX_FILESIZE.


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

Branch: refs/heads/calcite
Commit: fd6da35eee5b366530f73a435ae4bc4de0f0eb25
Parents: d94d571
Author: Lars Hofhansl 
Authored: Thu Sep 8 13:34:21 2016 -0700
Committer: Lars Hofhansl 
Committed: Thu Sep 8 13:35:16 2016 -0700

--
 .../query/ConnectionQueryServicesImpl.java  | 10 -
 .../org/apache/phoenix/query/QueryServices.java |  1 -
 .../phoenix/query/QueryServicesOptions.java |  1 -
 .../apache/phoenix/schema/MetaDataClient.java   | 22 
 4 files changed, 34 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/fd6da35e/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 04c2c7b..86217e7 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
@@ -1274,16 +1274,6 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 }
 byte[] physicalIndexName = 
MetaDataUtil.getViewIndexPhysicalName(physicalTableName);
 
-int indexMaxFileSizePerc;
-// Get percentage to use from table props first and then fallback to 
config
-Integer indexMaxFileSizePercProp = 
(Integer)tableProps.remove(QueryServices.INDEX_MAX_FILESIZE_PERC_ATTRIB);
-if (indexMaxFileSizePercProp == null) {
-indexMaxFileSizePerc = 
this.props.getInt(QueryServices.INDEX_MAX_FILESIZE_PERC_ATTRIB, 
QueryServicesOptions.DEFAULT_INDEX_MAX_FILESIZE_PERC);
-} else {
-indexMaxFileSizePerc = indexMaxFileSizePercProp;
-}
-long indexMaxFileSize = maxFileSize * indexMaxFileSizePerc / 100;
-tableProps.put(HTableDescriptor.MAX_FILESIZE, indexMaxFileSize);
 tableProps.put(MetaDataUtil.IS_VIEW_INDEX_TABLE_PROP_NAME, 
TRUE_BYTES_AS_STRING);
 HTableDescriptor desc = ensureTableCreated(physicalIndexName, 
PTableType.TABLE, tableProps, families, splits,
 false, isNamespaceMapped);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/fd6da35e/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServices.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServices.java 
b/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServices.java
index dbd0a99..8cd009a 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServices.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServices.java
@@ -113,7 +113,6 @@ public interface QueryServices extends SQLCloseable {
 public static final String ZOOKEEPER_ROOT_NODE_ATTRIB = 
"zookeeper.znode.parent";
 public static final String DISTINCT_VALUE_COMPRESS_THRESHOLD_ATTRIB = 
"phoenix.distinct.value.compress.threshold";
 public static final String SEQUENCE_CACHE_SIZE_ATTRIB = 
"phoenix.sequence.cacheSize";
-public static final String INDEX_MAX_FILESIZE_PERC_ATTRIB = 
"phoenix.index.maxDataFileSizePerc";
 public static final String 
MAX_SERVER_METADATA_CACHE_TIME_TO_LIVE_MS_ATTRIB = 
"phoenix.coprocessor.maxMetaDataCacheTimeToLiveMs";
 public static final String MAX_SERVER_METADATA_CACHE_SIZE_ATTRIB = 
"phoenix.coprocessor.maxMetaDataCacheSize";
 public static final String MAX_CLIENT_METADATA_CACHE_SIZE_ATTRIB = 
"phoenix.client.maxMetaDataCacheSize";

http://git-wip-us.apache.org/repos/asf/phoenix/blob/fd6da35e/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServicesOptions.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServicesOptions.java 
b/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServicesOptions.java
index 475c141..669bcd2 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServicesOptions.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServicesOptions.java
@@ -152,7 +152,6 @@ public class QueryServicesOptions {
 public static final long DEFAULT_GROUPBY_MAX_CACHE_MAX = 1024L*1024L*100L; 
 // 100 Mb
 
 public static final long DEFAULT_SEQUENCE_CACHE_SIZE = 100;  // reserve 
100 sequence

[34/47] phoenix git commit: PHOENIX-3290 Move and/or combine as many NeedsOwnCluster tests to bring down test run time

2016-09-20 Thread maryannxue
http://git-wip-us.apache.org/repos/asf/phoenix/blob/14d16c85/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexOnOwnClusterIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexOnOwnClusterIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexOnOwnClusterIT.java
deleted file mode 100644
index 4f0da4d..000
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexOnOwnClusterIT.java
+++ /dev/null
@@ -1,324 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.phoenix.end2end.index;
-
-import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HRegionInfo;
-import org.apache.hadoop.hbase.MetaTableAccessor;
-import org.apache.hadoop.hbase.TableName;
-import org.apache.hadoop.hbase.client.HBaseAdmin;
-import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.phoenix.end2end.BaseOwnClusterHBaseManagedTimeIT;
-import org.apache.phoenix.end2end.IndexToolIT;
-import org.apache.phoenix.jdbc.PhoenixConnection;
-import org.apache.phoenix.mapreduce.index.IndexTool;
-import org.apache.phoenix.query.QueryServices;
-import org.apache.phoenix.query.QueryServicesOptions;
-import org.apache.phoenix.util.ByteUtil;
-import org.apache.phoenix.util.PropertiesUtil;
-import org.apache.phoenix.util.QueryUtil;
-import org.apache.phoenix.util.ReadOnlyProps;
-import org.apache.phoenix.util.SchemaUtil;
-import org.apache.phoenix.util.TestUtil;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import com.google.common.collect.Maps;
-
-public class IndexOnOwnClusterIT extends BaseOwnClusterHBaseManagedTimeIT {
-
-@BeforeClass
-public static void doSetup() throws Exception {
-Map serverProps = Maps.newHashMapWithExpectedSize(1);
-serverProps.put(QueryServices.EXTRA_JDBC_ARGUMENTS_ATTRIB,
-QueryServicesOptions.DEFAULT_EXTRA_JDBC_ARGUMENTS);
-setUpRealDriver(new ReadOnlyProps(serverProps.entrySet().iterator()),
-ReadOnlyProps.EMPTY_PROPS);
-}
-
-@Test
-public void testDeleteFromImmutable() throws Exception {
-Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
-try (Connection conn = DriverManager.getConnection(getUrl(), props)) {
-conn.createStatement().execute("CREATE TABLE TEST_TABLE (\n" + 
-"pk1 VARCHAR NOT NULL,\n" + 
-"pk2 VARCHAR NOT NULL,\n" + 
-"pk3 VARCHAR\n" + 
-"CONSTRAINT PK PRIMARY KEY \n" + 
-"(\n" + 
-"pk1,\n" + 
-"pk2,\n" + 
-"pk3\n" + 
-")\n" + 
-") IMMUTABLE_ROWS=true");
-conn.createStatement().execute("upsert into TEST_TABLE (pk1, pk2, 
pk3) values ('a', '1', '1')");
-conn.createStatement().execute("upsert into TEST_TABLE (pk1, pk2, 
pk3) values ('b', '2', '2')");
-conn.commit();
-conn.createStatement().execute("CREATE INDEX TEST_INDEX ON 
TEST_TABLE (pk3, pk2) ASYNC");
-
-// this delete will be issued at a timestamp later than the above 
timestamp of the index table
-conn.createStatement().execute("delete from TEST_TABLE where pk1 = 
'a'");
-conn.commit();
-
-// run the index MR job
-final IndexTool indexingTool = new IndexTool();
-indexingTool.setConf(new 
Configuration(getUtility().getConfiguration()));
-final String[] cmdArgs =
-IndexToolIT.getArgValues(null, "TEST_TABLE", "TEST_INDEX",

[06/47] phoenix git commit: PHOENIX-3246 Treat U+2002 as whitespace in parser

2016-09-20 Thread maryannxue
PHOENIX-3246 Treat U+2002 as whitespace in parser


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

Branch: refs/heads/calcite
Commit: b65e385a828f89980ba4e5ae68f724d7cad50265
Parents: c02d6cb
Author: Josh Elser 
Authored: Sat Sep 3 19:21:43 2016 -0400
Committer: Josh Elser 
Committed: Wed Sep 7 14:19:06 2016 -0400

--
 phoenix-core/src/main/antlr3/PhoenixSQL.g |  5 +++--
 .../src/main/java/org/apache/phoenix/parse/SQLParser.java |  2 +-
 .../java/org/apache/phoenix/parse/QueryParserTest.java| 10 ++
 3 files changed, 14 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/b65e385a/phoenix-core/src/main/antlr3/PhoenixSQL.g
--
diff --git a/phoenix-core/src/main/antlr3/PhoenixSQL.g 
b/phoenix-core/src/main/antlr3/PhoenixSQL.g
index d8f28e5..bc48b19 100644
--- a/phoenix-core/src/main/antlr3/PhoenixSQL.g
+++ b/phoenix-core/src/main/antlr3/PhoenixSQL.g
@@ -1223,7 +1223,8 @@ FIELDCHAR
 :LETTER
 |DIGIT
 |'_'
-|'\u0080'..'\ufffe'
+|'\u0080'..'\u2001'
+|'\u2003'..'\ufffe'
 ;
 
 // A Letter is a lower or upper case ascii character.
@@ -1283,7 +1284,7 @@ CHAR_ESC
 
 // whitespace (skip)
 WS
-:   ( ' ' | '\t' ) { $channel=HIDDEN; }
+:   ( ' ' | '\t' | '\u2002' ) { $channel=HIDDEN; }
 ;
 
 EOL

http://git-wip-us.apache.org/repos/asf/phoenix/blob/b65e385a/phoenix-core/src/main/java/org/apache/phoenix/parse/SQLParser.java
--
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/parse/SQLParser.java 
b/phoenix-core/src/main/java/org/apache/phoenix/parse/SQLParser.java
index 36f756c..1a80991 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/parse/SQLParser.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/parse/SQLParser.java
@@ -192,4 +192,4 @@ public class SQLParser {
 return Character.toLowerCase(data[p + i - 1]);
 }
 }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/phoenix/blob/b65e385a/phoenix-core/src/test/java/org/apache/phoenix/parse/QueryParserTest.java
--
diff --git 
a/phoenix-core/src/test/java/org/apache/phoenix/parse/QueryParserTest.java 
b/phoenix-core/src/test/java/org/apache/phoenix/parse/QueryParserTest.java
index 70f590f..e7127b7 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/parse/QueryParserTest.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/parse/QueryParserTest.java
@@ -34,6 +34,8 @@ import org.apache.phoenix.jdbc.PhoenixStatement.Operation;
 import org.apache.phoenix.schema.SortOrder;
 import org.junit.Test;
 
+import com.google.common.base.Joiner;
+
 
 public class QueryParserTest {
 private void parseQuery(String sql) throws IOException, SQLException {
@@ -772,4 +774,12 @@ public class QueryParserTest {
 String sql = "SELECT * FROM T WHERE A LIKE 'a\\(d'";
 parseQuery(sql);
 }
+
+@Test
+public void testUnicodeSpace() throws Exception {
+// U+2002 (8194) is a "EN Space" which looks just like a normal space 
(0x20 in ascii) 
+String unicodeEnSpace = String.valueOf(Character.toChars(8194));
+String sql = Joiner.on(unicodeEnSpace).join(new String[] {"SELECT", 
"*", "FROM", "T"});
+parseQuery(sql);
+}
 }



[20/47] phoenix git commit: PHOENIX-3275 Reduce logging level of mutable secondary index logging

2016-09-20 Thread maryannxue
PHOENIX-3275 Reduce logging level of mutable secondary index logging


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

Branch: refs/heads/calcite
Commit: 27722998c35cbc14f8a6c1c1be1c0cc6b0f7769a
Parents: c0f72b5
Author: James Taylor 
Authored: Tue Sep 13 22:52:42 2016 -0700
Committer: James Taylor 
Committed: Tue Sep 13 22:52:42 2016 -0700

--
 .../phoenix/hbase/index/covered/NonTxIndexBuilder.java|  4 ++--
 .../phoenix/hbase/index/covered/data/IndexMemStore.java   | 10 +-
 .../hbase/index/covered/update/IndexUpdateManager.java|  4 ++--
 3 files changed, 9 insertions(+), 9 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/27722998/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/covered/NonTxIndexBuilder.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/covered/NonTxIndexBuilder.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/covered/NonTxIndexBuilder.java
index 10d164b..eb9dc96 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/covered/NonTxIndexBuilder.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/covered/NonTxIndexBuilder.java
@@ -70,8 +70,8 @@ public class NonTxIndexBuilder extends BaseIndexBuilder {
 
 batchMutationAndAddUpdates(manager, state, mutation, indexMetaData);
 
-if (LOG.isDebugEnabled()) {
-LOG.debug("Found index updates for Mutation: " + mutation + "\n" + 
manager);
+if (LOG.isTraceEnabled()) {
+LOG.trace("Found index updates for Mutation: " + mutation + "\n" + 
manager);
 }
 
 return manager.toMap();

http://git-wip-us.apache.org/repos/asf/phoenix/blob/27722998/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/covered/data/IndexMemStore.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/covered/data/IndexMemStore.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/covered/data/IndexMemStore.java
index 5b68fa2..0fc9e14 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/covered/data/IndexMemStore.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/covered/data/IndexMemStore.java
@@ -113,8 +113,8 @@ public class IndexMemStore implements KeyValueStore {
 
   @Override
   public void add(KeyValue kv, boolean overwrite) {
-if (LOG.isDebugEnabled()) {
-  LOG.info("Inserting: " + toString(kv));
+if (LOG.isTraceEnabled()) {
+  LOG.trace("Inserting: " + toString(kv));
 }
 // if overwriting, we will always update
 if (!overwrite) {
@@ -139,13 +139,13 @@ public class IndexMemStore implements KeyValueStore {
 
   private String toString(KeyValue kv) {
 return kv.toString() + "/value=" + 
-Bytes.toString(kv.getValueArray(), kv.getValueOffset(), 
kv.getValueLength());
+Bytes.toStringBinary(kv.getValueArray(), kv.getValueOffset(), 
kv.getValueLength());
   }
 
   @Override
   public void rollback(KeyValue kv) {
-if (LOG.isDebugEnabled()) {
-  LOG.debug("Rolling back: " + toString(kv));
+if (LOG.isTraceEnabled()) {
+  LOG.trace("Rolling back: " + toString(kv));
 }
 // If the key is in the store, delete it
 this.kvset.remove(kv);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/27722998/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/covered/update/IndexUpdateManager.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/covered/update/IndexUpdateManager.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/covered/update/IndexUpdateManager.java
index 26f620f..a183186 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/covered/update/IndexUpdateManager.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/covered/update/IndexUpdateManager.java
@@ -209,7 +209,7 @@ public class IndexUpdateManager {
   public String toString() {
 StringBuffer sb = new StringBuffer("Pending Index Updates:\n");
 for (Entry> entry : 
map.entrySet()) {
-  String tableName = Bytes.toString(entry.getKey().get());
+  String tableName = Bytes.toStringBinary(entry.getKey().get());
   sb.append("   Table: '" + tableName + "'\n");
   for (Mutation m : entry.getValue()) {
 sb.append("\t");
@@ -218,7 +218,7 @@ public class IndexUpdateManager {
 }
 sb.append(m.getClass().getSimpleName() + ":"
  

[09/47] phoenix git commit: PHOENIX-2946 Projected comparison between date and timestamp columns always returns true

2016-09-20 Thread maryannxue
PHOENIX-2946 Projected comparison between date and timestamp columns always 
returns true


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

Branch: refs/heads/calcite
Commit: 210445ded95d9da503c13cac24b4148aa819e205
Parents: 3a8724e
Author: James Taylor 
Authored: Wed Sep 7 20:18:04 2016 -0700
Committer: James Taylor 
Committed: Thu Sep 8 11:13:43 2016 -0700

--
 .../expression/function/CeilDateExpression.java |   3 +
 .../function/CeilTimestampExpression.java   |   3 +
 .../expression/function/DateScalarFunction.java |  54 ++
 .../expression/function/DayOfMonthFunction.java |   4 +-
 .../expression/function/DayOfWeekFunction.java  |   8 +-
 .../expression/function/DayOfYearFunction.java  |   7 +-
 .../expression/function/HourFunction.java   |   4 +-
 .../expression/function/MinuteFunction.java |   4 +-
 .../expression/function/MonthFunction.java  |   4 +-
 .../function/RoundDateExpression.java   |   3 +
 .../function/RoundJodaDateExpression.java   |   3 +
 .../expression/function/SecondFunction.java |   4 +-
 .../expression/function/ToDateFunction.java |  10 +-
 .../expression/function/WeekFunction.java   |   4 +-
 .../expression/function/YearFunction.java   |   4 +-
 .../phoenix/jdbc/PhoenixPreparedStatement.java  |  26 +-
 .../org/apache/phoenix/schema/SortOrder.java|  11 +
 .../apache/phoenix/schema/types/PDataType.java  |  19 +-
 .../org/apache/phoenix/schema/types/PDate.java  | 283 +-
 .../apache/phoenix/schema/types/PDecimal.java   |   6 +-
 .../org/apache/phoenix/schema/types/PLong.java  | 519 ++-
 .../org/apache/phoenix/schema/types/PTime.java  |   2 +-
 .../apache/phoenix/schema/types/PTimestamp.java |  42 +-
 .../phoenix/schema/types/PUnsignedDate.java | 259 +
 .../phoenix/schema/types/PUnsignedLong.java | 317 +--
 .../phoenix/schema/types/PUnsignedTime.java |   2 +-
 .../schema/types/PUnsignedTimestamp.java| 152 ++
 .../java/org/apache/phoenix/util/DateUtil.java  |  23 +-
 .../phoenix/util/csv/CsvUpsertExecutor.java |   8 +-
 .../phoenix/schema/types/PDataTypeTest.java |  18 +
 30 files changed, 977 insertions(+), 829 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/210445de/phoenix-core/src/main/java/org/apache/phoenix/expression/function/CeilDateExpression.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/CeilDateExpression.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/CeilDateExpression.java
index e3cd985..7629409 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/CeilDateExpression.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/CeilDateExpression.java
@@ -93,6 +93,9 @@ public class CeilDateExpression extends RoundDateExpression {
 @Override
 public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) {
 if (children.get(0).evaluate(tuple, ptr)) {
+if (ptr.getLength() == 0) {
+return true; // child evaluated to null
+}
 PDataType dataType = getDataType();
 long time = dataType.getCodec().decodeLong(ptr, 
children.get(0).getSortOrder());
 long value = roundTime(time);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/210445de/phoenix-core/src/main/java/org/apache/phoenix/expression/function/CeilTimestampExpression.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/CeilTimestampExpression.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/CeilTimestampExpression.java
index f69f2f8..b3a2a97 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/CeilTimestampExpression.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/CeilTimestampExpression.java
@@ -97,6 +97,9 @@ public class CeilTimestampExpression extends 
CeilDateExpression {
 @Override
 public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) {
 if (children.get(0).evaluate(tuple, ptr)) {
+if (ptr.getLength() == 0) {
+return true; // child evaluated to null
+}
 SortOrder sortOrder = children.get(0).getSortOrder();
 PDataType dataType = getDataType();
 int nanos = dataType.getNanos(ptr, sortOrder);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/210445de/phoenix-core/src/main/java/org

[33/47] phoenix git commit: PHOENIX-3285 Add test name in Parameters name since failsafe uses that to form report file name

2016-09-20 Thread maryannxue
PHOENIX-3285 Add test name in Parameters name since failsafe uses that to form 
report file name


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

Branch: refs/heads/calcite
Commit: 4c8bda1510606148e6d3d5154ed9004098ff239d
Parents: b0f9004
Author: James Taylor 
Authored: Thu Sep 15 17:07:13 2016 -0700
Committer: James Taylor 
Committed: Thu Sep 15 17:07:13 2016 -0700

--
 .../phoenix/end2end/AlterTableWithViewsIT.java  |   2 +-
 .../phoenix/end2end/AutoPartitionViewsIT.java   |   2 +-
 .../apache/phoenix/end2end/CaseStatementIT.java |   2 +-
 .../apache/phoenix/end2end/CastAndCoerceIT.java |   2 +-
 .../end2end/ClientTimeArithmeticQueryIT.java|   2 +-
 .../apache/phoenix/end2end/DerivedTableIT.java  |   4 +-
 .../apache/phoenix/end2end/DropSchemaIT.java|   2 +-
 .../org/apache/phoenix/end2end/GroupByIT.java   |   5 +-
 .../org/apache/phoenix/end2end/NotQueryIT.java  |   2 +-
 .../org/apache/phoenix/end2end/ScanQueryIT.java |   2 +-
 .../end2end/SequenceBulkAllocationIT.java   |   2 +-
 .../apache/phoenix/end2end/TenantIdTypeIT.java  |  12 +-
 .../phoenix/end2end/index/ImmutableIndexIT.java |   4 +-
 .../apache/phoenix/end2end/index/IndexIT.java   |   5 +-
 .../end2end/index/IndexOnOwnClusterIT.java  | 218 ++-
 .../end2end/index/MutableIndexFailureIT.java|   2 +-
 .../phoenix/end2end/index/MutableIndexIT.java   |   4 +-
 .../end2end/index/ReadOnlyIndexFailureIT.java   |   2 +-
 .../phoenix/end2end/index/ViewIndexIT.java  |   2 +-
 .../end2end/index/txn/MutableRollbackIT.java|   2 +-
 .../phoenix/end2end/index/txn/RollbackIT.java   |   2 +-
 .../end2end/index/txn/TxWriteFailureIT.java |   2 +-
 .../apache/phoenix/execute/PartialCommitIT.java |   5 +-
 .../org/apache/phoenix/tx/TxCheckpointIT.java   |   5 +-
 24 files changed, 248 insertions(+), 44 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/4c8bda15/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableWithViewsIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableWithViewsIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableWithViewsIT.java
index ae3b977..177a5c7 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableWithViewsIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableWithViewsIT.java
@@ -67,7 +67,7 @@ public class AlterTableWithViewsIT extends 
BaseHBaseManagedTimeTableReuseIT {
 this.isMultiTenant = isMultiTenant;
 }
 
-@Parameters(name="multiTenant = {0}")
+@Parameters(name="AlterTableWithViewsIT_multiTenant={0}") // name is used 
by failsafe as file name in reports
 public static Collection data() {
 return Arrays.asList(false, true);
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/4c8bda15/phoenix-core/src/it/java/org/apache/phoenix/end2end/AutoPartitionViewsIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AutoPartitionViewsIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AutoPartitionViewsIT.java
index 95ac2cb..f44c083 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AutoPartitionViewsIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AutoPartitionViewsIT.java
@@ -56,7 +56,7 @@ public class AutoPartitionViewsIT extends 
BaseHBaseManagedTimeTableReuseIT {
 private final String TENANT_SPECIFIC_URL2 = getUrl() + ';' + 
PhoenixRuntime.TENANT_ID_ATTRIB
 + "=tenant2";
 
-@Parameters(name = "salted = {0}, multi-tenant = {1}")
+@Parameters(name = "AutoPartitionViewsIT_salted={0},multi-tenant={1}") // 
name is used by failsafe as file name in reports
 public static Collection data() {
 return Arrays.asList(new Boolean[][] { { false, false }, { false, true 
}, { true, false },
 { true, true } });

http://git-wip-us.apache.org/repos/asf/phoenix/blob/4c8bda15/phoenix-core/src/it/java/org/apache/phoenix/end2end/CaseStatementIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CaseStatementIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CaseStatementIT.java
index bda1273..59b0f41 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CaseStatementIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CaseStatementIT.java
@@ -58,7 +58,7 @@ public class CaseStatementIT extends BaseQueryIT {
 s

[21/47] phoenix git commit: PHOENIX-3250 Remove static member variables to enable method-level parallelization

2016-09-20 Thread maryannxue
PHOENIX-3250 Remove static member variables to enable method-level 
parallelization


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

Branch: refs/heads/calcite
Commit: 850b02c6d7798a7ed466af3de4256da3aaa1616e
Parents: 2772299
Author: James Taylor 
Authored: Tue Sep 13 23:48:34 2016 -0700
Committer: James Taylor 
Committed: Tue Sep 13 23:48:34 2016 -0700

--
 .../end2end/ArrayToStringFunctionIT.java| 78 ++--
 .../apache/phoenix/end2end/PrimitiveTypeIT.java | 60 ++-
 .../phoenix/end2end/RegexpSplitFunctionIT.java  | 52 ++---
 .../apache/phoenix/end2end/StoreNullsIT.java| 56 +++---
 .../phoenix/end2end/ToCharFunctionIT.java   | 11 +--
 5 files changed, 135 insertions(+), 122 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/850b02c6/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayToStringFunctionIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayToStringFunctionIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayToStringFunctionIT.java
index 0439033..86ff7b6 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayToStringFunctionIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayToStringFunctionIT.java
@@ -21,22 +21,26 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
-import java.sql.*;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
 
-import org.junit.BeforeClass;
+import org.junit.Before;
 import org.junit.Test;
 
 public class ArrayToStringFunctionIT extends BaseHBaseManagedTimeTableReuseIT {
-private static final String REGIONS = generateRandomString();
-private static Connection conn = null;
+private String tableName;
+private Connection conn;
 
-@BeforeClass
-public static void initTables() throws Exception {
+@Before
+public void initTables() throws Exception {
 conn = DriverManager.getConnection(getUrl());
-String ddl = "CREATE TABLE " + REGIONS
+tableName = generateRandomString();
+String ddl = "CREATE TABLE " + tableName
 + " (region_name VARCHAR PRIMARY KEY,varchars VARCHAR[],integers 
INTEGER[],doubles DOUBLE[],bigints BIGINT[],chars CHAR(15)[],double1 
DOUBLE,varchar1 VARCHAR,nullcheck INTEGER,chars2 CHAR(15)[])";
 conn.createStatement().execute(ddl);
-String dml = "UPSERT INTO " + REGIONS
+String dml = "UPSERT INTO " + tableName
 + 
"(region_name,varchars,integers,doubles,bigints,chars,double1,varchar1,nullcheck,chars2)
 VALUES('SF Bay Area',"
 +
 "ARRAY['2345','46345','23234']," +
@@ -58,7 +62,7 @@ public class ArrayToStringFunctionIT extends 
BaseHBaseManagedTimeTableReuseIT {
 public void testArrayToStringFunctionVarchar1() throws Exception {
 ResultSet rs;
 rs = conn.createStatement().executeQuery(
-"SELECT ARRAY_TO_STRING(varchars, ',','*') FROM " + REGIONS
+"SELECT ARRAY_TO_STRING(varchars, ',','*') FROM " + tableName
 + " WHERE region_name = 'SF Bay Area'");
 assertTrue(rs.next());
 
@@ -72,7 +76,7 @@ public class ArrayToStringFunctionIT extends 
BaseHBaseManagedTimeTableReuseIT {
 public void testArrayToStringFunctionVarchar2() throws Exception {
 ResultSet rs;
 rs = conn.createStatement().executeQuery(
-"SELECT ARRAY_TO_STRING(varchars, ',') FROM " + REGIONS
+"SELECT ARRAY_TO_STRING(varchars, ',') FROM " + tableName
 + " WHERE region_name = 'SF Bay Area'");
 assertTrue(rs.next());
 
@@ -86,7 +90,7 @@ public class ArrayToStringFunctionIT extends 
BaseHBaseManagedTimeTableReuseIT {
 public void testArrayToStringFunctionVarchar3() throws Exception {
 ResultSet rs;
 rs = conn.createStatement().executeQuery(
-"SELECT ARRAY_TO_STRING(ARRAY['hello', 'hello'], ',') FROM " + 
REGIONS
+"SELECT ARRAY_TO_STRING(ARRAY['hello', 'hello'], ',') FROM " + 
tableName
 + " WHERE region_name = 'SF Bay Area'");
 assertTrue(rs.next());
 
@@ -100,7 +104,7 @@ public class ArrayToStringFunctionIT extends 
BaseHBaseManagedTimeTableReuseIT {
 public void testArrayToStringFunctionInt() throws Exception {
 ResultSet rs;
 rs = conn.createStatement().executeQuery(
-"SELECT ARRAY_TO_STRING(integers, 

[26/47] phoenix git commit: PHOENIX-3072 Deadlock on region opening with secondary index recovery (Enis Soztutar)

2016-09-20 Thread maryannxue
http://git-wip-us.apache.org/repos/asf/phoenix/blob/2c2b552c/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 607ad5e..767a600 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
@@ -39,6 +39,7 @@ import java.lang.ref.WeakReference;
 import java.sql.SQLException;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -85,6 +86,7 @@ import org.apache.hadoop.hbase.client.coprocessor.Batch;
 import org.apache.hadoop.hbase.coprocessor.MultiRowMutationEndpoint;
 import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
 import org.apache.hadoop.hbase.ipc.BlockingRpcCallback;
+import org.apache.hadoop.hbase.ipc.PhoenixRpcSchedulerFactory;
 import org.apache.hadoop.hbase.ipc.ServerRpcController;
 import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto;
 import org.apache.hadoop.hbase.regionserver.IndexHalfStoreFileReaderGenerator;
@@ -256,7 +258,7 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 // setting this member variable guarded by "connectionCountLock"
 private volatile ConcurrentMap sequenceMap = 
Maps.newConcurrentMap();
 private KeyValueBuilder kvBuilder;
-
+
 private final int renewLeaseTaskFrequency;
 private final int renewLeasePoolSize;
 private final int renewLeaseThreshold;
@@ -268,7 +270,7 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 private static interface FeatureSupported {
 boolean isSupported(ConnectionQueryServices services);
 }
-
+
 private final Map featureMap = 
ImmutableMap.of(
 Feature.LOCAL_INDEX, new FeatureSupported() {
 @Override
@@ -284,11 +286,11 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 return hbaseVersion >= 
PhoenixDatabaseMetaData.MIN_RENEW_LEASE_VERSION;
 }
 });
-
+
 private PMetaData newEmptyMetaData() {
 return new PSynchronizedMetaData(new 
PMetaDataImpl(INITIAL_META_DATA_TABLE_CAPACITY, getProps()));
 }
-
+
 /**
  * Construct a ConnectionQueryServicesImpl that represents a connection to 
an HBase
  * cluster.
@@ -346,7 +348,7 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 public TransactionSystemClient getTransactionSystemClient() {
 return txServiceClient;
 }
-
+
 private void initTxServiceClient() {
 String zkQuorumServersString = 
this.getProps().get(TxConstants.Service.CFG_DATA_TX_ZOOKEEPER_QUORUM);
 if (zkQuorumServersString==null) {
@@ -354,13 +356,13 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 }
 
 int timeOut = props.getInt(HConstants.ZK_SESSION_TIMEOUT, 
HConstants.DEFAULT_ZK_SESSION_TIMEOUT);
-// Create instance of the tephra zookeeper client 
+// Create instance of the tephra zookeeper client
 ZKClientService tephraZKClientService = new 
TephraZKClientService(zkQuorumServersString, timeOut, null, 
ArrayListMultimap.create());
-
+
 ZKClientService zkClientService = ZKClientServices.delegate(
-  ZKClients.reWatchOnExpire(
- ZKClients.retryOnFailure(tephraZKClientService, 
RetryStrategies.exponentialDelay(500, 2000, TimeUnit.MILLISECONDS))
-  )
+ZKClients.reWatchOnExpire(
+ZKClients.retryOnFailure(tephraZKClientService, 
RetryStrategies.exponentialDelay(500, 2000, TimeUnit.MILLISECONDS))
+)
 );
 zkClientService.startAndWait();
 ZKDiscoveryService zkDiscoveryService = new 
ZKDiscoveryService(zkClientService);
@@ -368,7 +370,7 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 config, zkDiscoveryService);
 this.txServiceClient = new 
TransactionServiceClient(config,pooledClientProvider);
 }
-
+
 private void openConnection() throws SQLException {
 try {
 boolean transactionsEnabled = props.getBoolean(
@@ -381,7 +383,7 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 this.connection = 
HBaseFactoryProvider.getHConnectionFactory().createConnection(this.config);
 } catch (IOException e) {
 throw new 
SQLExceptionInfo.Builder(SQLExceptionCod

[27/47] phoenix git commit: PHOENIX-3072 Deadlock on region opening with secondary index recovery (Enis Soztutar)

2016-09-20 Thread maryannxue
PHOENIX-3072 Deadlock on region opening with secondary index recovery (Enis 
Soztutar)

Signed-off-by: Josh Elser 


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

Branch: refs/heads/calcite
Commit: 2c2b552cd7c611c63677b0be075065504d579469
Parents: 7af7088
Author: James Taylor 
Authored: Tue Sep 13 22:37:18 2016 -0700
Committer: Josh Elser 
Committed: Wed Sep 14 14:44:04 2016 -0400

--
 .../apache/phoenix/end2end/index/IndexIT.java   | 1136 +-
 .../query/ConnectionQueryServicesImpl.java  | 1005 
 .../apache/phoenix/query/QueryConstants.java|5 +
 .../apache/phoenix/schema/MetaDataClient.java   |  568 -
 4 files changed, 1398 insertions(+), 1316 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/2c2b552c/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexIT.java
index 072e216..a5fefe2 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexIT.java
@@ -22,6 +22,7 @@ import static 
org.apache.phoenix.query.QueryConstants.MILLIS_IN_DAY;
 import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
@@ -43,11 +44,14 @@ import java.util.Properties;
 import org.apache.hadoop.hbase.Cell;
 import org.apache.hadoop.hbase.CellScanner;
 import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.client.HTableInterface;
 import org.apache.hadoop.hbase.client.Result;
 import org.apache.hadoop.hbase.client.ResultScanner;
 import org.apache.hadoop.hbase.client.Scan;
+import org.apache.hadoop.hbase.ipc.PhoenixRpcSchedulerFactory;
 import org.apache.phoenix.compile.ColumnResolver;
 import org.apache.phoenix.compile.FromCompiler;
 import org.apache.phoenix.end2end.BaseHBaseManagedTimeTableReuseIT;
@@ -59,6 +63,7 @@ import org.apache.phoenix.jdbc.PhoenixStatement;
 import org.apache.phoenix.parse.NamedTableNode;
 import org.apache.phoenix.parse.TableName;
 import org.apache.phoenix.query.BaseTest;
+import org.apache.phoenix.query.QueryConstants;
 import org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.schema.PTable;
 import org.apache.phoenix.schema.PTableKey;
@@ -79,45 +84,45 @@ import com.google.common.collect.Maps;
 
 @RunWith(Parameterized.class)
 public class IndexIT extends BaseOwnClusterIT {
-   
-   private final boolean localIndex;
+
+private final boolean localIndex;
 private final boolean transactional;
 private final boolean mutable;
-   private final String tableDDLOptions;
-
-   
-   public IndexIT(boolean localIndex, boolean mutable, boolean 
transactional) {
-   this.localIndex = localIndex;
-   this.transactional = transactional;
-   this.mutable = mutable;
-   StringBuilder optionBuilder = new StringBuilder();
-   if (!mutable) 
-   optionBuilder.append(" IMMUTABLE_ROWS=true ");
-   if (transactional) {
-   if (!(optionBuilder.length()==0))
-   optionBuilder.append(",");
-   optionBuilder.append(" TRANSACTIONAL=true ");
-   }
-   this.tableDDLOptions = optionBuilder.toString();
-   }
-   
-   @BeforeClass
+private final String tableDDLOptions;
+
+
+public IndexIT(boolean localIndex, boolean mutable, boolean transactional) 
{
+this.localIndex = localIndex;
+this.transactional = transactional;
+this.mutable = mutable;
+StringBuilder optionBuilder = new StringBuilder();
+if (!mutable)
+optionBuilder.append(" IMMUTABLE_ROWS=true ");
+if (transactional) {
+if (!(optionBuilder.length()==0))
+optionBuilder.append(",");
+optionBuilder.append(" TRANSACTIONAL=true ");
+}
+this.tableDDLOptions = optionBuilder.toString();
+}
+
+@BeforeClass
 @Shadower(classBeingShadowed = BaseHBa

[14/47] phoenix git commit: PHOENIX-3260 MetadataRegionObserver.postOpen() can prevent region server from shutting down for a long duration

2016-09-20 Thread maryannxue
PHOENIX-3260 MetadataRegionObserver.postOpen() can prevent region server from 
shutting down for a long duration


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

Branch: refs/heads/calcite
Commit: d9eb45e14d36f92982c36b85a7132675d6272770
Parents: df0d611
Author: Samarth 
Authored: Fri Sep 9 11:24:07 2016 -0700
Committer: Samarth 
Committed: Fri Sep 9 11:24:07 2016 -0700

--
 .../org/apache/phoenix/coprocessor/MetaDataRegionObserver.java   | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/d9eb45e1/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataRegionObserver.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataRegionObserver.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataRegionObserver.java
index 5243154..5beba49 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataRegionObserver.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataRegionObserver.java
@@ -156,7 +156,9 @@ public class MetaDataRegionObserver extends 
BaseRegionObserver {
 }
 }
 };
-(new Thread(r)).start();
+Thread t = new Thread(r);
+t.setDaemon(true);
+t.start();
 
 if (!enableRebuildIndex && !blockWriteRebuildIndex) {
 LOG.info("Failure Index Rebuild is skipped by configuration.");



[01/47] phoenix git commit: PHOENIX-2474 Cannot round to a negative precision (to the left of the decimal) (Kevin Liew)

2016-09-20 Thread maryannxue
Repository: phoenix
Updated Branches:
  refs/heads/calcite b8c8a4f50 -> b612f1696


PHOENIX-2474 Cannot round to a negative precision (to the left of the decimal) 
(Kevin Liew)


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

Branch: refs/heads/calcite
Commit: b7d45ca66729ae57c0896449e36b80f4fdcafb46
Parents: 1ce9845
Author: Samarth 
Authored: Thu Sep 1 09:49:22 2016 -0700
Committer: Samarth 
Committed: Thu Sep 1 09:49:22 2016 -0700

--
 .../expression/function/RoundDecimalExpression.java   |  2 +-
 .../expression/RoundFloorCeilExpressionsTest.java | 14 ++
 2 files changed, 15 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/b7d45ca6/phoenix-core/src/main/java/org/apache/phoenix/expression/function/RoundDecimalExpression.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/RoundDecimalExpression.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/RoundDecimalExpression.java
index 65ffacb..055535e 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/RoundDecimalExpression.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/RoundDecimalExpression.java
@@ -100,7 +100,7 @@ public class RoundDecimalExpression extends ScalarFunction {
 if(scaleValue != null) {
 if (scaleType.isCoercibleTo(PInteger.INSTANCE, scaleValue)) {
 int scale = (Integer) PInteger.INSTANCE.toObject(scaleValue, 
scaleType);
-if (scale >=0 && scale <= PDataType.MAX_PRECISION) {
+if (scale <= PDataType.MAX_PRECISION) {
 this.scale = scale;
 return;
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/b7d45ca6/phoenix-core/src/test/java/org/apache/phoenix/expression/RoundFloorCeilExpressionsTest.java
--
diff --git 
a/phoenix-core/src/test/java/org/apache/phoenix/expression/RoundFloorCeilExpressionsTest.java
 
b/phoenix-core/src/test/java/org/apache/phoenix/expression/RoundFloorCeilExpressionsTest.java
index 5022e71..89058ba 100644
--- 
a/phoenix-core/src/test/java/org/apache/phoenix/expression/RoundFloorCeilExpressionsTest.java
+++ 
b/phoenix-core/src/test/java/org/apache/phoenix/expression/RoundFloorCeilExpressionsTest.java
@@ -79,6 +79,20 @@ public class RoundFloorCeilExpressionsTest {
 }
 
 @Test
+public void testRoundNegativePrecisionDecimalExpression() throws Exception 
{
+LiteralExpression decimalLiteral = 
LiteralExpression.newConstant(444.44, PDecimal.INSTANCE);
+Expression roundDecimalExpression = 
RoundDecimalExpression.create(decimalLiteral, -2);
+
+ImmutableBytesWritable ptr = new ImmutableBytesWritable();
+roundDecimalExpression.evaluate(null, ptr);
+Object result = roundDecimalExpression.getDataType().toObject(ptr);
+
+assertTrue(result instanceof BigDecimal);
+BigDecimal resultDecimal = (BigDecimal)result;
+assertEquals(0, BigDecimal.valueOf(400).compareTo(resultDecimal));
+}
+
+@Test
 public void testRoundDecimalExpressionNoop() throws Exception {
 LiteralExpression decimalLiteral = LiteralExpression.newConstant(5, 
PInteger.INSTANCE);
 Expression roundDecimalExpression = 
RoundDecimalExpression.create(decimalLiteral, 3);



[46/47] phoenix git commit: PHOENIX-3279 QueryPlan.iterator(ParallelScanGrouper scanGrouper) should pass null ('unknown') as scan parameter when calling this.iterator(ParallelScanGrouper scanGrouper,

2016-09-20 Thread maryannxue
PHOENIX-3279 QueryPlan.iterator(ParallelScanGrouper scanGrouper) should pass 
null ('unknown') as scan parameter when calling 
this.iterator(ParallelScanGrouper scanGrouper, Scan scan)


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

Branch: refs/heads/calcite
Commit: 7601d5942fdeb55c114295292e2100aafb84e861
Parents: 0a05d67
Author: maryannxue 
Authored: Tue Sep 20 09:19:06 2016 -0700
Committer: maryannxue 
Committed: Tue Sep 20 09:19:06 2016 -0700

--
 .../apache/phoenix/end2end/DerivedTableIT.java  | 11 ++
 .../apache/phoenix/execute/BaseQueryPlan.java   | 16 +--
 .../phoenix/execute/ClientAggregatePlan.java|  7 +--
 .../phoenix/execute/ClientProcessingPlan.java   |  9 -
 .../apache/phoenix/execute/ClientScanPlan.java  |  4 
 .../apache/phoenix/execute/CorrelatePlan.java   | 15 ++
 .../phoenix/execute/DelegateQueryPlan.java  | 13 
 .../apache/phoenix/execute/HashJoinPlan.java| 15 --
 .../phoenix/execute/TupleProjectionPlan.java| 11 --
 .../org/apache/phoenix/execute/UnionPlan.java   | 21 
 .../apache/phoenix/execute/UnnestArrayPlan.java | 11 --
 .../phoenix/iterate/UnionResultIterators.java   |  4 +---
 12 files changed, 50 insertions(+), 87 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/7601d594/phoenix-core/src/it/java/org/apache/phoenix/end2end/DerivedTableIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DerivedTableIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DerivedTableIT.java
index 862416b..67be132 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DerivedTableIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DerivedTableIT.java
@@ -225,6 +225,17 @@ public class DerivedTableIT extends 
BaseClientManagedTimeIT {
 assertEquals(ROW2,rs.getString(1));
 
 assertFalse(rs.next());
+
+// ((where limit) where limit) limit
+query = "SELECT u.eid FROM (SELECT t.eid FROM (SELECT entity_id 
eid, b_string b FROM aTable WHERE a_string = '" + B_VALUE + "' LIMIT 5) AS t 
WHERE t.b = '" + C_VALUE + "' LIMIT 4) AS u WHERE u.eid >= '" + ROW1 + "' LIMIT 
3";
+statement = conn.prepareStatement(query);
+rs = statement.executeQuery();
+assertTrue (rs.next());
+assertEquals(ROW5,rs.getString(1));
+assertTrue (rs.next());
+assertEquals(ROW8,rs.getString(1));
+
+assertFalse(rs.next());
 
 // (count) where
 query = "SELECT t.c FROM (SELECT count(*) c FROM aTable) AS t 
WHERE t.c > 0";

http://git-wip-us.apache.org/repos/asf/phoenix/blob/7601d594/phoenix-core/src/main/java/org/apache/phoenix/execute/BaseQueryPlan.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/execute/BaseQueryPlan.java 
b/phoenix-core/src/main/java/org/apache/phoenix/execute/BaseQueryPlan.java
index 1e09079..76dec2f 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/execute/BaseQueryPlan.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/execute/BaseQueryPlan.java
@@ -200,10 +200,15 @@ public abstract class BaseQueryPlan implements QueryPlan {
 //byte[] producer = Bytes.toBytes(UUID.randomUUID().toString());
 //scan.setAttribute(HBaseServer.CALL_QUEUE_PRODUCER_ATTRIB_NAME, 
producer);
 //}
+
+@Override
+public final ResultIterator iterator() throws SQLException {
+return iterator(Collections.emptyList(), 
DefaultParallelScanGrouper.getInstance(), null);
+}
 
 @Override
 public final ResultIterator iterator(ParallelScanGrouper scanGrouper) 
throws SQLException {
-return iterator(Collections.emptyList(), scanGrouper, 
this.context.getScan());
+return iterator(Collections.emptyList(), scanGrouper, 
null);
 }
 
 @Override
@@ -211,12 +216,11 @@ public abstract class BaseQueryPlan implements QueryPlan {
 return iterator(Collections.emptyList(), scanGrouper, 
scan);
 }
 
-@Override
-public final ResultIterator iterator() throws SQLException {
-return iterator(Collections.emptyList(), 
DefaultParallelScanGrouper.getInstance(), this.context.getScan());
-}
-
 public final ResultIterator iterator(final List 
dependencies, ParallelScanGrouper scanGrouper, Scan scan) throws SQLException {
+ if (scan == null) {
+ scan = context.getScan();
+   

[17/47] phoenix git commit: PHOENIX-3176 Remove unnecessary PQS proxy user authorization

2016-09-20 Thread maryannxue
PHOENIX-3176 Remove unnecessary PQS proxy user authorization


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

Branch: refs/heads/calcite
Commit: c3cdb2afbe60a4959237a6ac264f42322a049d1d
Parents: 5a6496e
Author: Josh Elser 
Authored: Sat Sep 10 16:05:15 2016 -0400
Committer: Josh Elser 
Committed: Sun Sep 11 15:03:43 2016 -0400

--
 .../main/java/org/apache/phoenix/queryserver/server/Main.java| 4 
 1 file changed, 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/c3cdb2af/phoenix-queryserver/src/main/java/org/apache/phoenix/queryserver/server/Main.java
--
diff --git 
a/phoenix-queryserver/src/main/java/org/apache/phoenix/queryserver/server/Main.java
 
b/phoenix-queryserver/src/main/java/org/apache/phoenix/queryserver/server/Main.java
index 4b3ca7e..0ed3b7b 100644
--- 
a/phoenix-queryserver/src/main/java/org/apache/phoenix/queryserver/server/Main.java
+++ 
b/phoenix-queryserver/src/main/java/org/apache/phoenix/queryserver/server/Main.java
@@ -286,10 +286,6 @@ public final class Main extends Configured implements 
Tool, Runnable {
   // LoadingCache will create a new instance for us if one isn't cached.
   UserGroupInformation proxyUser = createProxyUser(remoteUserName);
 
-  // Check if this user is allowed to be impersonated.
-  // Will throw AuthorizationException if the impersonation as this user 
is not allowed
-  ProxyUsers.authorize(proxyUser, remoteAddress);
-
   // Execute the actual call as this proxy user
   return proxyUser.doAs(new PrivilegedExceptionAction() {
 @Override



[29/47] phoenix git commit: PHOENIX-3280 Automatic attempt to rebuild all disabled index

2016-09-20 Thread maryannxue
PHOENIX-3280 Automatic attempt to rebuild all disabled index


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

Branch: refs/heads/calcite
Commit: 2a223adfbeb32f598308da1dc6d3251ee0980d79
Parents: 27697b3
Author: James Taylor 
Authored: Thu Sep 15 00:48:24 2016 -0700
Committer: James Taylor 
Committed: Thu Sep 15 00:48:24 2016 -0700

--
 .../coprocessor/MetaDataRegionObserver.java | 179 +++
 1 file changed, 104 insertions(+), 75 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/2a223adf/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataRegionObserver.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataRegionObserver.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataRegionObserver.java
index f1dc982..00981f5 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataRegionObserver.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataRegionObserver.java
@@ -20,8 +20,8 @@ package org.apache.phoenix.coprocessor;
 import java.io.IOException;
 import java.sql.SQLException;
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.List;
+import java.util.Map;
 import java.util.Properties;
 import java.util.TimerTask;
 import java.util.concurrent.ScheduledThreadPoolExecutor;
@@ -79,6 +79,7 @@ import org.apache.phoenix.util.SchemaUtil;
 import org.apache.phoenix.util.UpgradeUtil;
 
 import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
 
 
 /**
@@ -223,13 +224,11 @@ public class MetaDataRegionObserver extends 
BaseRegionObserver {
 scan.addColumn(PhoenixDatabaseMetaData.TABLE_FAMILY_BYTES,
 PhoenixDatabaseMetaData.INDEX_DISABLE_TIMESTAMP_BYTES);
 
-PTable dataPTable = null;
+Map> dataTableToIndexesMap = null;
 MetaDataClient client = null;
 boolean hasMore = false;
 List results = new ArrayList();
-List indexesToPartiallyRebuild = 
Collections.emptyList();
 scanner = this.env.getRegion().getScanner(scan);
-long earliestDisableTimestamp = Long.MAX_VALUE;
 
 do {
 results.clear();
@@ -249,19 +248,12 @@ public class MetaDataRegionObserver extends 
BaseRegionObserver {
 if (disabledTimeStampVal <= 0) {
 continue;
 }
-if (disabledTimeStampVal < earliestDisableTimestamp) {
-earliestDisableTimestamp = disabledTimeStampVal;
-}
-
 byte[] dataTable = 
r.getValue(PhoenixDatabaseMetaData.TABLE_FAMILY_BYTES,
 PhoenixDatabaseMetaData.DATA_TABLE_NAME_BYTES);
-byte[] indexStat = 
r.getValue(PhoenixDatabaseMetaData.TABLE_FAMILY_BYTES,
+byte[] indexState = 
r.getValue(PhoenixDatabaseMetaData.TABLE_FAMILY_BYTES,
 PhoenixDatabaseMetaData.INDEX_STATE_BYTES);
-if ((dataTable == null || dataTable.length == 0) || 
(indexStat == null || indexStat.length == 0)
-|| (dataPTable != null
-&& 
Bytes.compareTo(dataPTable.getName().getBytes(), dataTable) != 0)) {
+if ((dataTable == null || dataTable.length == 0) || 
(indexState == null || indexState.length == 0)) {
 // data table name can't be empty
-// we need to build indexes of same data table. so 
skip other indexes for this task.
 continue;
 }
 
@@ -284,14 +276,19 @@ public class MetaDataRegionObserver extends 
BaseRegionObserver {
// don't run a second index populations upsert select 
 
props.setProperty(QueryServices.INDEX_POPULATION_SLEEP_TIME, "0"); 
 conn = QueryUtil.getConnectionOnServer(props, 
env.getConfiguration()).unwrap(PhoenixConnection.class);
-String dataTableFullName = 
SchemaUtil.getTableName(schemaName, dataTable);
-dataPTable = PhoenixRuntime.getTable(conn, 
dataTableFullName);
-indexesToPartiallyRebuild = 
Lists.newArrayListWithExpectedSize(dataPTable.getIndexes().size());
 client = new MetaDataClient(conn);
+dataTableToIndexesMap = Maps.newHashM

[08/47] phoenix git commit: PHOENIX-2946 Projected comparison between date and timestamp columns always returns true

2016-09-20 Thread maryannxue
http://git-wip-us.apache.org/repos/asf/phoenix/blob/210445de/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedLong.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedLong.java 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedLong.java
index a21ccc3..1ee46fd 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedLong.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedLong.java
@@ -19,6 +19,7 @@ package org.apache.phoenix.schema.types;
 
 import java.math.BigDecimal;
 
+import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.Order;
 import org.apache.phoenix.schema.SortOrder;
@@ -37,163 +38,175 @@ import com.google.common.primitives.Longs;
  */
 public class PUnsignedLong extends PWholeNumber {
 
-  public static final PUnsignedLong INSTANCE = new PUnsignedLong();
-
-  private PUnsignedLong() {
-super("UNSIGNED_LONG", 10 /* no constant available in Types */, Long.class,
-new UnsignedLongCodec(), 15);
-  }
-
-  @Override
-  public boolean isOrderPreserving() {
-return true;
-  }
-
-  @Override
-  public Order getOrder() {
-return Order.ASCENDING;
-  }
-
-  @Override
-  public boolean isSkippable() {
-return true;
-  }
-
-  @Override
-  public Integer getScale(Object o) {
-return ZERO;
-  }
-
-  @Override
-  public byte[] toBytes(Object object) {
-byte[] b = new byte[Bytes.SIZEOF_LONG];
-toBytes(object, b, 0);
-return b;
-  }
-
-  @Override
-  public int toBytes(Object object, byte[] b, int o) {
-if (object == null) {
-  throw newIllegalDataException(this + " may not be null");
-}
-return this.getCodec().encodeLong(((Number) object).longValue(), b, o);
-  }
-
-  @Override
-  public Object toObject(Object object, PDataType actualType) {
-Long v = (Long) PLong.INSTANCE.toObject(object, actualType);
-throwIfNonNegativeNumber(v);
-return v;
-  }
-
-  @Override
-  public Object toObject(byte[] b, int o, int l, PDataType actualType, 
SortOrder sortOrder,
-  Integer maxLength, Integer scale) {
-Long v = (Long) PLong.INSTANCE.toObject(b, o, l, actualType, sortOrder);
-throwIfNonNegativeNumber(v);
-return v;
-  }
-
-  @Override
+public static final PUnsignedLong INSTANCE = new PUnsignedLong();
+
+private PUnsignedLong() {
+super("UNSIGNED_LONG", 10 /* no constant available in Types */, 
Long.class,
+new UnsignedLongCodec(), 15);
+}
+
+@Override
+public boolean isOrderPreserving() {
+return true;
+}
+
+@Override
+public Order getOrder() {
+return Order.ASCENDING;
+}
+
+@Override
+public boolean isSkippable() {
+return true;
+}
+
+@Override
+public Integer getScale(Object o) {
+return ZERO;
+}
+
+@Override
+public byte[] toBytes(Object object) {
+byte[] b = new byte[Bytes.SIZEOF_LONG];
+toBytes(object, b, 0);
+return b;
+}
+
+@Override
+public int toBytes(Object object, byte[] b, int o) {
+if (object == null) {
+throw newIllegalDataException(this + " may not be null");
+}
+return this.getCodec().encodeLong(((Number) object).longValue(), b, o);
+}
+
+@Override
+public Object toObject(Object object, PDataType actualType) {
+Long v = (Long) PLong.INSTANCE.toObject(object, actualType);
+throwIfNonNegativeNumber(v);
+return v;
+}
+
+@Override
+public Object toObject(byte[] b, int o, int l, PDataType actualType, 
SortOrder sortOrder,
+Integer maxLength, Integer scale) {
+Long v = (Long) PLong.INSTANCE.toObject(b, o, l, actualType, 
sortOrder);
+throwIfNonNegativeNumber(v);
+return v;
+}
+
+@Override
 public boolean isCastableTo(PDataType targetType) {
-  return super.isCastableTo(targetType) || 
targetType.isCoercibleTo(PTimestamp.INSTANCE);
-}
-
-  @Override
-  public boolean isCoercibleTo(PDataType targetType) {
-return targetType == this || targetType == PUnsignedDouble.INSTANCE || 
PLong.INSTANCE
-.isCoercibleTo(targetType);
-  }
-
-  @Override
-  public boolean isCoercibleTo(PDataType targetType, Object value) {
-return super.isCoercibleTo(targetType, value) || 
PLong.INSTANCE.isCoercibleTo(targetType, value);
-  }
-
-  @Override
-  public boolean isFixedWidth() {
-return true;
-  }
-
-  @Override
-  public Integer getByteSize() {
-return Bytes.SIZEOF_LONG;
-  }
-
-  @Override
-  public int compareTo(Object lhs, Object rhs, PDataType rhsType) {
-if (rhsType == PDecimal.INSTANCE) {
-  return -((BigDecimal) rhs).compareTo(BigDecimal.valueOf(((Number) 
lhs).longValue()));
-} else if (equalsAny(rhsType, PDouble.INSTANCE, PFloat.INST

[22/47] phoenix git commit: PHOENIX-3237 Automatic rebuild of disabled index will fail if indexes of two tables are disabled at the same time

2016-09-20 Thread maryannxue
PHOENIX-3237 Automatic rebuild of disabled index will fail if indexes of two 
tables are disabled at the same time


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

Branch: refs/heads/calcite
Commit: b640b39ce8cbd36fab33c79ea81ed500dd882f99
Parents: 850b02c
Author: Ankit Singhal 
Authored: Wed Sep 14 13:40:49 2016 +0530
Committer: Ankit Singhal 
Committed: Wed Sep 14 13:40:49 2016 +0530

--
 .../end2end/index/MutableIndexFailureIT.java| 239 +++
 .../coprocessor/MetaDataRegionObserver.java |   6 +-
 2 files changed, 143 insertions(+), 102 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/b640b39c/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexFailureIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexFailureIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexFailureIT.java
index 5d0230b..0a85216 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexFailureIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexFailureIT.java
@@ -49,7 +49,6 @@ import org.apache.phoenix.query.QueryConstants;
 import org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.schema.PIndexState;
 import org.apache.phoenix.schema.PTableType;
-import org.apache.phoenix.util.MetaDataUtil;
 import org.apache.phoenix.util.PropertiesUtil;
 import org.apache.phoenix.util.QueryUtil;
 import org.apache.phoenix.util.ReadOnlyProps;
@@ -128,6 +127,9 @@ public class MutableIndexFailureIT extends 
BaseOwnClusterHBaseManagedTimeIT {
 }
 
 public void helpTestWriteFailureDisablesIndex() throws Exception {
+String secondTableName = fullTableName + "_2";
+String secondIndexName = indexName + "_2";
+String secondFullIndexName = fullIndexName + "_2";
 Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
 props.put(QueryServices.IS_NAMESPACE_MAPPING_ENABLED, 
String.valueOf(isNamespaceMapped));
 try (Connection conn = driver.connect(url, props)) {
@@ -139,6 +141,8 @@ public class MutableIndexFailureIT extends 
BaseOwnClusterHBaseManagedTimeIT {
 }
 conn.createStatement().execute("CREATE TABLE " + fullTableName
 + " (k VARCHAR NOT NULL PRIMARY KEY, v1 VARCHAR, v2 
VARCHAR) " + tableDDLOptions);
+conn.createStatement().execute("CREATE TABLE " + secondTableName
++ " (k VARCHAR NOT NULL PRIMARY KEY, v1 VARCHAR, v2 
VARCHAR) " + tableDDLOptions);
 query = "SELECT * FROM " + fullTableName;
 rs = conn.createStatement().executeQuery(query);
 assertFalse(rs.next());
@@ -146,34 +150,26 @@ public class MutableIndexFailureIT extends 
BaseOwnClusterHBaseManagedTimeIT {
 FAIL_WRITE = false;
 conn.createStatement().execute(
 "CREATE " + (localIndex ? "LOCAL " : "") + "INDEX " + 
indexName + " ON " + fullTableName + " (v1) INCLUDE (v2)");
+conn.createStatement().execute(
+"CREATE " + (localIndex ? "LOCAL " : "") + "INDEX " + 
secondIndexName + " ON " + secondTableName + " (v1) INCLUDE (v2)");
 
 query = "SELECT * FROM " + fullIndexName;
 rs = conn.createStatement().executeQuery(query);
 assertFalse(rs.next());
 
 // Verify the metadata for index is correct.
-rs = conn.getMetaData().getTables(null, 
StringUtil.escapeLike(schema), indexName,
+rs = conn.getMetaData().getTables(null, 
StringUtil.escapeLike(schema), indexName+"%",
 new String[] { PTableType.INDEX.toString() });
 assertTrue(rs.next());
 assertEquals(indexName, rs.getString(3));
 assertEquals(PIndexState.ACTIVE.toString(), 
rs.getString("INDEX_STATE"));
+assertTrue(rs.next());
+assertEquals(secondIndexName, rs.getString(3));
+assertEquals(PIndexState.ACTIVE.toString(), 
rs.getString("INDEX_STATE"));
 assertFalse(rs.next());
-
-PreparedStatement stmt = conn.prepareStatement("UPSERT INTO " + 
fullTableName + " VALUES(?,?,?)");
-stmt.setString(1, "a");
-stmt.setString(2, "x");
-stmt.setString(3, "1");
-stmt.execute();
-stmt.setString(1, "b");
-stmt.setString(2, "y");
-stmt.setString(3, "2");
-stmt.execute();
-stmt.setString(1, "c");
-stmt.s

[36/47] phoenix git commit: PHOENIX-3290 Move and/or combine as many NeedsOwnCluster tests to bring down test run time

2016-09-20 Thread maryannxue
http://git-wip-us.apache.org/repos/asf/phoenix/blob/14d16c85/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseViewIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseViewIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseViewIT.java
index d9a59a9..a3c36fa 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseViewIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseViewIT.java
@@ -69,7 +69,6 @@ public abstract class BaseViewIT extends 
BaseOwnClusterHBaseManagedTimeIT {
 public static void doSetup() throws Exception {
 Map props = Maps.newHashMapWithExpectedSize(3);
 props.put(QueryServices.STATS_GUIDEPOST_WIDTH_BYTES_ATTRIB, 
Integer.toString(20));
-props.put(QueryServices.QUEUE_SIZE_ATTRIB, Integer.toString(1024));
 props.put(QueryServices.TRANSACTIONS_ENABLED, Boolean.toString(true));
 setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator()));
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/14d16c85/phoenix-core/src/it/java/org/apache/phoenix/end2end/CsvBulkLoadToolIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CsvBulkLoadToolIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CsvBulkLoadToolIT.java
index 8968555..4971fc3 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CsvBulkLoadToolIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CsvBulkLoadToolIT.java
@@ -40,7 +40,9 @@ import org.apache.phoenix.mapreduce.CsvBulkLoadTool;
 import org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.query.QueryServicesOptions;
 import org.apache.phoenix.util.DateUtil;
+import org.apache.phoenix.util.PhoenixRuntime;
 import org.apache.phoenix.util.ReadOnlyProps;
+import org.apache.phoenix.util.TestUtil;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
@@ -57,8 +59,8 @@ public class CsvBulkLoadToolIT extends 
BaseOwnClusterHBaseManagedTimeIT {
 serverProps.put(QueryServices.EXTRA_JDBC_ARGUMENTS_ATTRIB, 
QueryServicesOptions.DEFAULT_EXTRA_JDBC_ARGUMENTS);
 Map clientProps = Maps.newHashMapWithExpectedSize(1);
 clientProps.put(QueryServices.TRANSACTIONS_ENABLED, "true");
-setUpRealDriver(new ReadOnlyProps(serverProps.entrySet().iterator()), 
new ReadOnlyProps(clientProps.entrySet().iterator()));
-zkQuorum = "localhost:" + getUtility().getZkCluster().getClientPort();
+setUpTestDriver(new ReadOnlyProps(serverProps.entrySet().iterator()), 
new ReadOnlyProps(clientProps.entrySet().iterator()));
+zkQuorum = TestUtil.LOCALHOST + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR 
+ getUtility().getZkCluster().getClientPort();
 conn = DriverManager.getConnection(getUrl());
 }
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/14d16c85/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexExtendedIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexExtendedIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexExtendedIT.java
new file mode 100644
index 000..b23e342
--- /dev/null
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexExtendedIT.java
@@ -0,0 +1,578 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.phoenix.end2end;
+
+import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.UUID;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.HRegionInfo;
+import org.apache.hadoop.hbase.MetaTableAccesso

[43/47] phoenix git commit: PHOENIX-3174 Make minor upgrade a manual step

2016-09-20 Thread maryannxue
http://git-wip-us.apache.org/repos/asf/phoenix/blob/e90feaa3/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 1aa9b88..dfe7ee8 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
@@ -63,6 +63,7 @@ import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.ThreadLocalRandom;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
+import java.util.concurrent.atomic.AtomicBoolean;
 
 import javax.annotation.concurrent.GuardedBy;
 
@@ -131,6 +132,8 @@ import 
org.apache.phoenix.coprocessor.generated.MetaDataProtos.UpdateIndexStateR
 import org.apache.phoenix.exception.PhoenixIOException;
 import org.apache.phoenix.exception.SQLExceptionCode;
 import org.apache.phoenix.exception.SQLExceptionInfo;
+import org.apache.phoenix.exception.UpgradeInProgressException;
+import org.apache.phoenix.exception.UpgradeNotRequiredException;
 import org.apache.phoenix.execute.MutationState;
 import org.apache.phoenix.hbase.index.IndexRegionSplitPolicy;
 import org.apache.phoenix.hbase.index.Indexer;
@@ -266,6 +269,8 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 private final List>> 
connectionQueues;
 private ScheduledExecutorService renewLeaseExecutor;
 private final boolean renewLeaseEnabled;
+private final boolean isAutoUpgradeEnabled;
+private final AtomicBoolean upgradeRequired = new AtomicBoolean(false);
 
 private static interface FeatureSupported {
 boolean isSupported(ConnectionQueryServices services);
@@ -342,6 +347,7 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 connectionQueues = ImmutableList.copyOf(list);
 // A little bit of a smell to leak `this` here, but should not be a 
problem
 this.tableStatsCache = new TableStatsCache(this, config);
+this.isAutoUpgradeEnabled = config.getBoolean(AUTO_UPGRADE_ENABLED, 
QueryServicesOptions.DEFAULT_AUTO_UPGRADE_ENABLED);
 }
 
 @Override
@@ -2310,29 +2316,16 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 return null;
 }
 checkClosed();
-PhoenixConnection metaConnection = null;
-boolean success = false;
-String snapshotName = null;
-String sysCatalogTableName = null;
 try {
 openConnection();
-String noUpgradeProp = 
props.getProperty(PhoenixRuntime.NO_UPGRADE_ATTRIB);
-boolean upgradeSystemTables = 
!Boolean.TRUE.equals(Boolean.valueOf(noUpgradeProp));
-Properties scnProps = 
PropertiesUtil.deepCopy(props);
-scnProps.setProperty(
-PhoenixRuntime.CURRENT_SCN_ATTRIB,
-
Long.toString(MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP));
-scnProps.remove(PhoenixRuntime.TENANT_ID_ATTRIB);
-String globalUrl = JDBCUtil.removeProperty(url, 
PhoenixRuntime.TENANT_ID_ATTRIB);
-metaConnection = new PhoenixConnection(
-ConnectionQueryServicesImpl.this, 
globalUrl, scnProps, newEmptyMetaData());
+boolean isDoNotUpgradePropSet = 
UpgradeUtil.isNoUpgradeSet(props);
 try (HBaseAdmin admin = getAdmin()) {
 boolean mappedSystemCatalogExists = admin
 
.tableExists(SchemaUtil.getPhysicalTableName(SYSTEM_CATALOG_NAME_BYTES, true));
 if 
(SchemaUtil.isNamespaceMappingEnabled(PTableType.SYSTEM,
 
ConnectionQueryServicesImpl.this.getProps())) {
 if 
(admin.tableExists(SYSTEM_CATALOG_NAME_BYTES)) {
-//check if the server is already 
updated and have namespace config properly set.
+//check if the server is already 
updated and have namespace config properly set. 
 
checkClientServerCompatibility(SYSTEM_CATALOG_NAME_BYTES);
 }
 
ensureSystemTablesUpgraded(ConnectionQueryServicesImpl.this.getProps());
@@ -2345,2

[32/47] phoenix git commit: PHOENIX-3249 Make changes in LocalIndexIT for method level parallelization in BaseHBaseManagedTimeTableReuseIT

2016-09-20 Thread maryannxue
PHOENIX-3249 Make changes in LocalIndexIT for method level parallelization in 
BaseHBaseManagedTimeTableReuseIT


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

Branch: refs/heads/calcite
Commit: b0f900488dec92d0eaac8e2576991281e78984f5
Parents: 1a3bd43
Author: James Taylor 
Authored: Thu Sep 15 17:01:27 2016 -0700
Committer: James Taylor 
Committed: Thu Sep 15 17:01:27 2016 -0700

--
 .../end2end/index/AsyncImmutableIndexIT.java| 114 --
 .../end2end/index/IndexOnOwnClusterIT.java  | 114 ++
 .../phoenix/end2end/index/LocalIndexIT.java | 215 ++-
 3 files changed, 129 insertions(+), 314 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/b0f90048/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/AsyncImmutableIndexIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/AsyncImmutableIndexIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/AsyncImmutableIndexIT.java
deleted file mode 100644
index 8c90b6e..000
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/AsyncImmutableIndexIT.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.phoenix.end2end.index;
-
-import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.ResultSet;
-import java.util.Map;
-import java.util.Properties;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.phoenix.end2end.BaseOwnClusterHBaseManagedTimeIT;
-import org.apache.phoenix.end2end.IndexToolIT;
-import org.apache.phoenix.mapreduce.index.IndexTool;
-import org.apache.phoenix.query.QueryServices;
-import org.apache.phoenix.query.QueryServicesOptions;
-import org.apache.phoenix.util.PropertiesUtil;
-import org.apache.phoenix.util.QueryUtil;
-import org.apache.phoenix.util.ReadOnlyProps;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import com.google.common.collect.Maps;
-
-public class AsyncImmutableIndexIT extends BaseOwnClusterHBaseManagedTimeIT {
-
-@BeforeClass
-public static void doSetup() throws Exception {
-Map serverProps = Maps.newHashMapWithExpectedSize(1);
-serverProps.put(QueryServices.EXTRA_JDBC_ARGUMENTS_ATTRIB,
-QueryServicesOptions.DEFAULT_EXTRA_JDBC_ARGUMENTS);
-setUpRealDriver(new ReadOnlyProps(serverProps.entrySet().iterator()),
-ReadOnlyProps.EMPTY_PROPS);
-}
-
-@Test
-public void testDeleteFromImmutable() throws Exception {
-Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
-try (Connection conn = DriverManager.getConnection(getUrl(), props)) {
-conn.createStatement().execute("CREATE TABLE TEST_TABLE (\n" + 
-"pk1 VARCHAR NOT NULL,\n" + 
-"pk2 VARCHAR NOT NULL,\n" + 
-"pk3 VARCHAR\n" + 
-"CONSTRAINT PK PRIMARY KEY \n" + 
-"(\n" + 
-"pk1,\n" + 
-"pk2,\n" + 
-"pk3\n" + 
-")\n" + 
-") IMMUTABLE_ROWS=true");
-conn.createStatement().execute("upsert into TEST_TABLE (pk1, pk2, 
pk3) values ('a', '1', '1')");
-conn.createStatement().execute("upsert into TEST_TABLE (pk1, pk2, 
pk3) values ('b', '2', '2')");
-conn.commit();
-conn.createStatement().execute("CREATE INDEX TEST_INDEX ON 
TEST_TABLE (pk3, pk2) ASYNC");
-
-   

[03/47] phoenix git commit: Implement DAYOFWEEK and DAYOFYEAR built-in functions (Prakul Agarwal)

2016-09-20 Thread maryannxue
Implement DAYOFWEEK and DAYOFYEAR built-in functions (Prakul Agarwal)


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

Branch: refs/heads/calcite
Commit: fce0f1033e252ecb55d168f63284be330a8fbda7
Parents: 06d37e5
Author: Samarth 
Authored: Thu Sep 1 15:32:42 2016 -0700
Committer: Samarth 
Committed: Thu Sep 1 15:32:42 2016 -0700

--
 .../org/apache/phoenix/end2end/DateTimeIT.java  | 45 ++
 .../phoenix/expression/ExpressionType.java  |  9 +-
 .../expression/function/DayOfWeekFunction.java  | 86 
 .../expression/function/DayOfYearFunction.java  | 77 ++
 4 files changed, 215 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/fce0f103/phoenix-core/src/it/java/org/apache/phoenix/end2end/DateTimeIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DateTimeIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DateTimeIT.java
index 227374a..05a8ec8 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DateTimeIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DateTimeIT.java
@@ -688,6 +688,51 @@ public class DateTimeIT extends 
BaseHBaseManagedTimeTableReuseIT {
 assertFalse(rs.next());
 }
 
+/*
+Reference for dates used in the test
+2013-04-09 - Tuesday (2)
+ 2014-05-18 - Sunday (7)
+2015-06-27 - Saturday (6)
+ */
+@Test
+public void testDayOfWeekFuncAgainstColumns() throws Exception {
+String tableName = generateRandomString();
+String ddl = "CREATE TABLE IF NOT EXISTS " + tableName + " (k1 INTEGER 
NOT NULL, dates DATE, timestamps TIMESTAMP, times TIME CONSTRAINT pk PRIMARY 
KEY (k1))";
+conn.createStatement().execute(ddl);
+String dml = "UPSERT INTO " + tableName + " VALUES (1, 
TO_DATE('2012-03-08 11:01:10'), TO_TIMESTAMP('2013-06-16 12:02:20'), 
TO_TIME('2014-09-23 13:03:30'))";
+conn.createStatement().execute(dml);
+dml = "UPSERT INTO " + tableName + " VALUES (2, TO_DATE('2013-04-09 
11:02:10'), TO_TIMESTAMP('2014-05-18 12:03:20'), TO_TIME('2015-06-27 
13:04:30'))";
+conn.createStatement().execute(dml);
+conn.commit();
+
+ResultSet rs = conn.createStatement().executeQuery("SELECT k1, 
DAYOFWEEK(dates), DAYOFWEEK(timestamps) FROM " + tableName + " where 
DAYOFWEEK(times)=6");
+assertTrue(rs.next());
+assertEquals(2, rs.getInt(1));
+assertEquals(2, rs.getInt(2));
+assertEquals(7, rs.getInt(3));
+assertFalse(rs.next());
+}
+
+@Test
+public void testDayOfYearFuncAgainstColumns() throws Exception {
+String tableName = generateRandomString();
+String ddl = "CREATE TABLE IF NOT EXISTS " + tableName + " (k1 INTEGER 
NOT NULL, dates DATE, timestamps TIMESTAMP, times TIME CONSTRAINT pk PRIMARY 
KEY (k1))";
+conn.createStatement().execute(ddl);
+String dml = "UPSERT INTO " + tableName + " VALUES (1, 
TO_DATE('2012-03-01 11:01:10'), TO_TIMESTAMP('2013-02-01 12:02:20'), 
TO_TIME('2014-01-15 13:03:30'))";
+conn.createStatement().execute(dml);
+dml = "UPSERT INTO " + tableName + " VALUES (2, TO_DATE('2013-04-09 
11:02:10'), TO_TIMESTAMP('2014-05-18 12:03:20'), TO_TIME('2015-06-27 
13:04:30'))";
+conn.createStatement().execute(dml);
+conn.commit();
+
+ResultSet rs = conn.createStatement().executeQuery("SELECT k1, 
DAYOFYEAR(dates), DAYOFYEAR(timestamps) FROM " + tableName + " where 
DAYOFYEAR(times)=15");
+
+assertTrue(rs.next());
+assertEquals(1, rs.getInt(1));
+assertEquals(61, rs.getInt(2));
+assertEquals(32, rs.getInt(3));
+assertFalse(rs.next());
+}
+
 @Test
 public void testNullDate() throws Exception {
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/fce0f103/phoenix-core/src/main/java/org/apache/phoenix/expression/ExpressionType.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/ExpressionType.java 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/ExpressionType.java
index f13e265..94120e9 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/ExpressionType.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/ExpressionType.java
@@ -125,6 +125,8 @@ import org.apache.phoenix.expression.function.UDFExpression;
 import org.apache.phoenix.expression.function.UpperFunction;
 import org.apache.phoenix.expression.function.WeekFunction;
 i

[37/47] phoenix git commit: PHOENIX-3290 Move and/or combine as many NeedsOwnCluster tests to bring down test run time

2016-09-20 Thread maryannxue
http://git-wip-us.apache.org/repos/asf/phoenix/blob/14d16c85/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java
index e09dcea..857f953 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java
@@ -35,8 +35,6 @@ import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.sql.Statement;
-import java.util.Collections;
-import java.util.Map;
 import java.util.Properties;
 
 import org.apache.hadoop.hbase.HColumnDescriptor;
@@ -48,20 +46,18 @@ import org.apache.hadoop.hbase.client.Result;
 import org.apache.hadoop.hbase.client.ResultScanner;
 import org.apache.hadoop.hbase.client.Scan;
 import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.phoenix.coprocessor.MetaDataProtocol;
 import org.apache.phoenix.exception.SQLExceptionCode;
 import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
+import org.apache.phoenix.query.BaseTest;
 import org.apache.phoenix.query.QueryConstants;
 import org.apache.phoenix.schema.PTable;
 import org.apache.phoenix.schema.PTableKey;
 import org.apache.phoenix.schema.TableNotFoundException;
 import org.apache.phoenix.util.IndexUtil;
-import org.apache.phoenix.util.PhoenixRuntime;
 import org.apache.phoenix.util.PropertiesUtil;
-import org.apache.phoenix.util.ReadOnlyProps;
 import org.apache.phoenix.util.SchemaUtil;
-import org.junit.BeforeClass;
+import org.junit.Before;
 import org.junit.Test;
 
 /**
@@ -75,19 +71,24 @@ import org.junit.Test;
  * or at the end of test class.
  *
  */
-public class AlterTableIT extends BaseOwnClusterHBaseManagedTimeIT {
-public static final String SCHEMA_NAME = "";
-public static final String DATA_TABLE_NAME = "T";
-public static final String INDEX_TABLE_NAME = "I";
-public static final String LOCAL_INDEX_TABLE_NAME = "LI";
-public static final String DATA_TABLE_FULL_NAME = 
SchemaUtil.getTableName(SCHEMA_NAME, "T");
-public static final String INDEX_TABLE_FULL_NAME = 
SchemaUtil.getTableName(SCHEMA_NAME, "I");
-public static final String LOCAL_INDEX_TABLE_FULL_NAME = 
SchemaUtil.getTableName(SCHEMA_NAME, "LI");
-
-@BeforeClass
-public static void doSetup() throws Exception {
-Map props = Collections.emptyMap();
-setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator()));
+public class AlterTableIT extends BaseHBaseManagedTimeTableReuseIT {
+private String schemaName;
+private String dataTableName;
+private String indexTableName;
+private String localIndexTableName;
+private String dataTableFullName;
+private String indexTableFullName;
+private String localIndexTableFullName;
+
+@Before
+public void setupTableNames() throws Exception {
+schemaName = "";
+dataTableName = generateRandomString();
+indexTableName = "I_" + generateRandomString();
+localIndexTableName = "LI_" + generateRandomString();
+dataTableFullName = SchemaUtil.getTableName(schemaName, dataTableName);
+indexTableFullName = SchemaUtil.getTableName(schemaName, 
indexTableName);
+localIndexTableFullName = SchemaUtil.getTableName(schemaName, 
localIndexTableName);
 }
 
 @Test
@@ -97,12 +98,12 @@ public class AlterTableIT extends 
BaseOwnClusterHBaseManagedTimeIT {
 conn.setAutoCommit(false);
 
 try {
-String ddl = "CREATE TABLE test_table " +
+String ddl = "CREATE TABLE  " + dataTableFullName +
 "  (a_string varchar not null, a_binary varbinary not 
null, col1 integer" +
 "  CONSTRAINT pk PRIMARY KEY (a_string, a_binary))\n";
 createTestTable(getUrl(), ddl);
 
-ddl = "ALTER TABLE test_table ADD b_string VARCHAR NULL PRIMARY 
KEY";
+ddl = "ALTER TABLE " + dataTableFullName + " ADD b_string VARCHAR 
NULL PRIMARY KEY";
 PreparedStatement stmt = conn.prepareStatement(ddl);
 stmt.execute();
 fail("Should have caught bad alter.");
@@ -114,27 +115,6 @@ public class AlterTableIT extends 
BaseOwnClusterHBaseManagedTimeIT {
 }
 
 @Test
-public void testAddColsIntoSystemTable() throws Exception {
-Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
-props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB,
-Long.toString(MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP + 
1));
-Connection conn = DriverManager.getConnection(getUrl(), props);
-
-  try{
-conn.createStatement().executeUpdate("ALTER TABLE " + 
PhoenixDatabaseMetaData.SYSTEM_CATALOG +
-  " ADD IF NOT EXISTS testNewColu

[42/47] phoenix git commit: PHOENIX-3268 Upgrade to Tephra 0.9.0

2016-09-20 Thread maryannxue
PHOENIX-3268 Upgrade to Tephra 0.9.0


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

Branch: refs/heads/calcite
Commit: e8ffc9c53513309c249aca740620ecc5df48a26a
Parents: 6b86839
Author: James Taylor 
Authored: Mon Sep 19 07:49:29 2016 -0700
Committer: James Taylor 
Committed: Mon Sep 19 07:49:29 2016 -0700

--
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/e8ffc9c5/pom.xml
--
diff --git a/pom.xml b/pom.xml
index 242c987..3c000e2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -98,7 +98,7 @@
 2.1.2
 1.8.0
 8.1.7.v20120910
-0.8.0-incubating
+0.9.0-incubating
 1.6.1
 2.10.4
 2.10



[23/47] phoenix git commit: PHOENIX-3162 TableNotFoundException might be thrown when an index dropped while upserting.(Rajeshbabu)

2016-09-20 Thread maryannxue
PHOENIX-3162 TableNotFoundException might be thrown when an index dropped while 
upserting.(Rajeshbabu)


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

Branch: refs/heads/calcite
Commit: e4fd03952a15be60eee6ddc557a19ce917c606c2
Parents: b640b39
Author: Rajeshbabu Chintaguntla 
Authored: Wed Sep 14 21:03:22 2016 +0530
Committer: Rajeshbabu Chintaguntla 
Committed: Wed Sep 14 21:03:22 2016 +0530

--
 .../end2end/index/MutableIndexFailureIT.java| 34 +---
 .../index/PhoenixIndexFailurePolicy.java|  5 +--
 2 files changed, 32 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/e4fd0395/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexFailureIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexFailureIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexFailureIT.java
index 0a85216..c68d897 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexFailureIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexFailureIT.java
@@ -45,6 +45,7 @@ import 
org.apache.hadoop.hbase.regionserver.MiniBatchOperationInProgress;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.phoenix.end2end.BaseOwnClusterHBaseManagedTimeIT;
 import org.apache.phoenix.end2end.NeedsOwnMiniClusterTest;
+import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.query.QueryConstants;
 import org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.schema.PIndexState;
@@ -79,7 +80,7 @@ public class MutableIndexFailureIT extends 
BaseOwnClusterHBaseManagedTimeIT {
 
 private String tableName;
 private String indexName;
-private String fullTableName;
+public static volatile String fullTableName;
 private String fullIndexName;
 
 private final boolean transactional;
@@ -150,6 +151,11 @@ public class MutableIndexFailureIT extends 
BaseOwnClusterHBaseManagedTimeIT {
 FAIL_WRITE = false;
 conn.createStatement().execute(
 "CREATE " + (localIndex ? "LOCAL " : "") + "INDEX " + 
indexName + " ON " + fullTableName + " (v1) INCLUDE (v2)");
+// Create other index which should be local/global if the other 
index is global/local to
+// check the drop index.
+conn.createStatement().execute(
+"CREATE " + (!localIndex ? "LOCAL " : "") + "INDEX " + 
indexName + "_3" + " ON "
++ fullTableName + " (v2) INCLUDE (v1)");
 conn.createStatement().execute(
 "CREATE " + (localIndex ? "LOCAL " : "") + "INDEX " + 
secondIndexName + " ON " + secondTableName + " (v1) INCLUDE (v2)");
 
@@ -166,7 +172,9 @@ public class MutableIndexFailureIT extends 
BaseOwnClusterHBaseManagedTimeIT {
 assertTrue(rs.next());
 assertEquals(secondIndexName, rs.getString(3));
 assertEquals(PIndexState.ACTIVE.toString(), 
rs.getString("INDEX_STATE"));
-assertFalse(rs.next());
+assertTrue(rs.next());
+assertEquals(indexName+"_3", rs.getString(3));
+assertEquals(PIndexState.ACTIVE.toString(), 
rs.getString("INDEX_STATE"));
 initializeTable(conn, fullTableName);
 initializeTable(conn, secondTableName);
 
@@ -262,7 +270,9 @@ public class MutableIndexFailureIT extends 
BaseOwnClusterHBaseManagedTimeIT {
 stmt.setString(3, "4");
 stmt.execute();
 conn.commit();
-
+// To clear the index name from connection.
+PhoenixConnection phoenixConn = 
conn.unwrap(PhoenixConnection.class);
+phoenixConn.getMetaDataCache().removeTable(null, fullTableName, 
null, HConstants.LATEST_TIMESTAMP);
 // verify index table has correct data
 validateDataWithIndex(conn, fullTableName, fullIndexName);
 validateDataWithIndex(conn, secondTableName, secondFullIndexName);
@@ -306,7 +316,7 @@ public class MutableIndexFailureIT extends 
BaseOwnClusterHBaseManagedTimeIT {
 }
 
 private void validateDataWithIndex(Connection conn, String tableName, 
String indexName) throws SQLException {
-String query = "SELECT /*+ INDEX(" + indexName + ") */ k,v1 FROM " + 
tableName;
+String query = "SELECT /*+ INDEX(" + indexName + ")  */ k,v1 FROM " + 
tableName;
 ResultSet rs = conn.createStatement().executeQuery("EXPLAIN " + query);
 String expected

[19/47] phoenix git commit: PHOENIX-3170 Remove the futuretask from the list if StaleRegionBoundaryCacheException is thrown while initializing the scanners(Rajeshbabu)

2016-09-20 Thread maryannxue
PHOENIX-3170 Remove the futuretask from the list if 
StaleRegionBoundaryCacheException is thrown while initializing the 
scanners(Rajeshbabu)


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

Branch: refs/heads/calcite
Commit: c0f72b536684bdbb6f3e597d5d93e767732bd007
Parents: 47a2b2c
Author: Rajeshbabu Chintaguntla 
Authored: Tue Sep 13 16:33:46 2016 +0530
Committer: Rajeshbabu Chintaguntla 
Committed: Tue Sep 13 16:33:46 2016 +0530

--
 .../java/org/apache/phoenix/iterate/BaseResultIterators.java   | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/c0f72b53/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 8b9adfd..2685b93 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
@@ -31,6 +31,7 @@ import java.io.EOFException;
 import java.sql.SQLException;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
@@ -751,7 +752,9 @@ public abstract class BaseResultIterators extends 
ExplainTable implements Result
 boolean clearedCache = false;
 for (List>> future : 
reverseIfNecessary(futures,isReverse)) {
 List concatIterators = 
Lists.newArrayListWithExpectedSize(future.size());
-for (Pair> scanPair : 
reverseIfNecessary(future,isReverse)) {
+Iterator>> 
scanPairItr = reverseIfNecessary(future,isReverse).iterator();
+while (scanPairItr.hasNext()) {
+Pair> scanPair = 
scanPairItr.next();
 try {
 long timeOutForScan = maxQueryEndTime - 
System.currentTimeMillis();
 if (timeOutForScan < 0) {
@@ -773,6 +776,7 @@ public abstract class BaseResultIterators extends 
ExplainTable implements Result
 try { // Rethrow as SQLException
 throw ServerUtil.parseServerException(e);
 } catch (StaleRegionBoundaryCacheException e2) {
+scanPairItr.remove();
 // Catch only to try to recover from region 
boundary cache being out of date
 if (!clearedCache) { // Clear cache once so that 
we rejigger job based on new boundaries
 
services.clearTableRegionCache(physicalTableName);



[35/47] phoenix git commit: PHOENIX-3290 Move and/or combine as many NeedsOwnCluster tests to bring down test run time

2016-09-20 Thread maryannxue
http://git-wip-us.apache.org/repos/asf/phoenix/blob/14d16c85/phoenix-core/src/it/java/org/apache/phoenix/end2end/RoundFloorCeilFunctionsEnd2EndIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/RoundFloorCeilFunctionsEnd2EndIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/RoundFloorCeilFunctionsEnd2EndIT.java
deleted file mode 100644
index c365934..000
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/RoundFloorCeilFunctionsEnd2EndIT.java
+++ /dev/null
@@ -1,686 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.phoenix.end2end;
-
-import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES;
-import static org.apache.phoenix.util.TestUtil.closeStmtAndConn;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.math.BigDecimal;
-import java.sql.Connection;
-import java.sql.Date;
-import java.sql.DriverManager;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Time;
-import java.sql.Timestamp;
-import java.util.Properties;
-
-import org.apache.phoenix.expression.function.CeilFunction;
-import org.apache.phoenix.expression.function.FloorFunction;
-import org.apache.phoenix.expression.function.RoundFunction;
-import org.apache.phoenix.query.QueryServices;
-import org.apache.phoenix.util.DateUtil;
-import org.apache.phoenix.util.PhoenixRuntime;
-import org.apache.phoenix.util.PropertiesUtil;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.google.common.primitives.Doubles;
-import com.google.common.primitives.Floats;
-
-/**
- * 
- * End to end tests for {@link RoundFunction}, {@link FloorFunction}, {@link 
CeilFunction} 
- *
- * 
- * @since 3.0.0
- */
-
-
-public class RoundFloorCeilFunctionsEnd2EndIT extends 
BaseHBaseManagedTimeTableReuseIT {
-
-  private static final String TABLE_NAME = generateRandomString();
-  private static long millisPart = 660;
-private static int nanosPart = 500100;
-private static BigDecimal decimalUpserted = BigDecimal.valueOf(1.264);
-private static double doubleUpserted = 1.264d;
-private static double unsignedDoubleUpserted = 1.264d;
-private static float floatUpserted = 1.264f;
-private static float unsignedFloatUpserted = 1.264f;
-
-@Before
-public void initTable() throws Exception {
-String testString = "abc";
-Connection conn = null;
-PreparedStatement stmt = null;
-try {
-conn = DriverManager.getConnection(getUrl());
-String ddl = "CREATE TABLE IF NOT EXISTS " + TABLE_NAME
-+ " (s VARCHAR NOT NULL PRIMARY KEY, dt DATE, t TIME, ts 
TIMESTAMP, dec DECIMAL, doub DOUBLE, undoub UNSIGNED_DOUBLE, fl FLOAT, unfl 
UNSIGNED_FLOAT)";
-conn.createStatement().execute(ddl);
-
-Date dateUpserted = DateUtil.parseDate("2012-01-01 14:25:28");
-dateUpserted = new Date(dateUpserted.getTime() + millisPart); // 
this makes the dateUpserted equivalent to 2012-01-01 14:25:28.660 
-long millis = dateUpserted.getTime();
-
-Time timeUpserted = new Time(millis);
-Timestamp tsUpserted = DateUtil.getTimestamp(millis, nanosPart);
-
-stmt =  conn.prepareStatement(
-"UPSERT INTO " + TABLE_NAME + " VALUES (?, ?, ?, ?, ?, ?, ?, 
?, ?)");
-stmt.setString(1, testString);
-stmt.setDate(2, dateUpserted);
-stmt.setTime(3, timeUpserted);
-stmt.setTimestamp(4, tsUpserted);
-stmt.setBigDecimal(5, decimalUpserted);
-stmt.setDouble(6, doubleUpserted);
-stmt.setDouble(7, unsignedDoubleUpserted);
-stmt.setFloat(8, floatUpserted);
-stmt.setFloat(9, unsignedFloatUpserted);
-stmt.executeUpdate();
-conn.commit();
-} finally {
-closeStmtAndConn(stmt, conn);
-}
-}
-
-@Test
-public void testRoundingUpDate() throws Exception {
-Connection conn = DriverManager.getConnection(getUrl());
-Res

[04/47] phoenix git commit: PHOENIX-3054 Counting zero null rows returns an empty result set

2016-09-20 Thread maryannxue
PHOENIX-3054 Counting zero null rows returns an empty result set


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

Branch: refs/heads/calcite
Commit: 7827178b7addbd336d5a5c3b12a4e1b764f0f74a
Parents: fce0f10
Author: Ankit Singhal 
Authored: Tue Sep 6 10:58:33 2016 +0530
Committer: Ankit Singhal 
Committed: Tue Sep 6 10:58:33 2016 +0530

--
 .../phoenix/end2end/AggregateQueryIT.java   | 36 
 .../phoenix/end2end/index/ViewIndexIT.java  | 25 +-
 .../apache/phoenix/execute/BaseQueryPlan.java   |  7 +++-
 .../iterate/MergeSortResultIterator.java|  2 +-
 4 files changed, 52 insertions(+), 18 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/7827178b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AggregateQueryIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AggregateQueryIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AggregateQueryIT.java
index f23b5eb..01cc2c1 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AggregateQueryIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AggregateQueryIT.java
@@ -191,6 +191,42 @@ public class AggregateQueryIT extends BaseQueryIT {
 conn.close();
 }
 }
+
+
+@Test
+public void testCountWithNoScanRanges() throws Exception {
+String query = "SELECT count(1) FROM aTable WHERE organization_id = 
'not_existing_organization_id'";
+Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 2)); // Execute at timestamp 2
+   Connection conn = DriverManager.getConnection(getUrl(), props);
+   try {
+   PreparedStatement statement = 
conn.prepareStatement(query);
+   ResultSet rs = statement.executeQuery();
+   assertTrue(rs.next());
+   assertEquals(0, rs.getLong(1));
+   assertFalse(rs.next());
+   query = "SELECT count(1) FROM aTable WHERE 
organization_id = 'not_existing_organization_id' having count(*)>0";
+   rs = conn.prepareStatement(query).executeQuery();
+   assertFalse(rs.next());
+   query = "SELECT count(1) FROM aTable WHERE 
organization_id = 'not_existing_organization_id' limit 1 offset 1";
+   rs = conn.prepareStatement(query).executeQuery();
+   assertFalse(rs.next());
+   query = "SELECT count(1),123 FROM aTable WHERE 
organization_id = 'not_existing_organization_id'";
+   rs = conn.prepareStatement(query).executeQuery();
+   assertTrue(rs.next());
+   assertEquals(0, rs.getLong(1));
+   assertEquals("123", rs.getString(2));
+   assertFalse(rs.next());
+   query = "SELECT count(1),sum(x_decimal) FROM aTable 
WHERE organization_id = 'not_existing_organization_id'";
+   rs = conn.prepareStatement(query).executeQuery();
+   assertTrue(rs.next());
+   assertEquals(0, rs.getLong(1));
+   assertEquals(null, rs.getBigDecimal(2));
+   assertFalse(rs.next());
+   } finally {
+   conn.close();
+   }
+   }
 
 @Test
 public void testCountIsNotNull() throws Exception {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/7827178b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ViewIndexIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ViewIndexIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ViewIndexIT.java
index d97a749..c985fc9 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ViewIndexIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ViewIndexIT.java
@@ -39,17 +39,14 @@ import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.phoenix.compile.QueryPlan;
 import org.apache.phoenix.end2end.BaseHBaseManagedTimeTableReuseIT;
 import org.apache.phoenix.end2end.Shadower;
-import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
 import org.apache.phoenix.jdbc.PhoenixStatement;
 import org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.schema.PNameFactory;
-import

[28/47] phoenix git commit: PHOENIX-3253 Make changes in various classes for method level parallelization in BaseHBaseManagedTimeTableReuseIT

2016-09-20 Thread maryannxue
PHOENIX-3253 Make changes in various classes for method level parallelization 
in BaseHBaseManagedTimeTableReuseIT


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

Branch: refs/heads/calcite
Commit: 27697b364511f8557a87d4007bff1a560e4b8490
Parents: 2c2b552
Author: James Taylor 
Authored: Thu Sep 15 00:22:33 2016 -0700
Committer: James Taylor 
Committed: Thu Sep 15 00:28:46 2016 -0700

--
 .../ConnectionQueryServicesTestImpl.java|  7 ++-
 .../org/apache/phoenix/end2end/DeleteIT.java| 10 ++--
 .../phoenix/end2end/PhoenixRuntimeIT.java   | 48 +---
 .../phoenix/end2end/index/ViewIndexIT.java  | 41 +++--
 .../trace/PhoenixTableMetricsWriterIT.java  | 22 +
 .../phoenix/trace/PhoenixTraceReaderIT.java | 16 ---
 .../phoenix/trace/PhoenixTracingEndToEndIT.java | 23 +-
 .../org/apache/phoenix/tx/TransactionIT.java| 27 ++-
 .../phoenix/trace/PhoenixMetricsSink.java   |  5 +-
 .../org/apache/phoenix/trace/TraceReader.java   | 12 ++---
 10 files changed, 91 insertions(+), 120 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/27697b36/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConnectionQueryServicesTestImpl.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConnectionQueryServicesTestImpl.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConnectionQueryServicesTestImpl.java
index 48f392b..b1e264b 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConnectionQueryServicesTestImpl.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConnectionQueryServicesTestImpl.java
@@ -20,6 +20,8 @@ package org.apache.phoenix.end2end;
 import static org.junit.Assert.assertEquals;
 
 import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Properties;
 import java.util.Set;
 
@@ -61,9 +63,10 @@ public class ConnectionQueryServicesTestImpl extends 
ConnectionQueryServicesImpl
 @Override
 public void close() throws SQLException {
 try {
-Set connections;
+Collection connections;
 synchronized(this) {
-connections = this.connections;
+// Make copy to prevent ConcurrentModificationException (TODO: 
figure out why this is necessary)
+connections = new ArrayList<>(this.connections);
 this.connections = Sets.newHashSet();
 }
 SQLCloseables.closeAll(connections);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/27697b36/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java
--
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java
index 865b1fd..5234d10 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java
@@ -34,7 +34,6 @@ import java.util.Collections;
 import java.util.List;
 
 import org.apache.phoenix.util.QueryUtil;
-import org.junit.Assert;
 import org.junit.Test;
 
 
@@ -506,16 +505,17 @@ public class DeleteIT extends 
BaseHBaseManagedTimeTableReuseIT {
 
 @Test
 public void testDeleteForTableWithRowTimestampColServer() throws Exception 
{
-testDeleteForTableWithRowTimestampCol(true);
+String tableName = generateRandomString();
+testDeleteForTableWithRowTimestampCol(true, tableName);
 }
 
 @Test
 public void testDeleteForTableWithRowTimestampColClient() throws Exception 
{
-testDeleteForTableWithRowTimestampCol(false);
+String tableName = generateRandomString();
+testDeleteForTableWithRowTimestampCol(false, tableName);
 }
 
-private void testDeleteForTableWithRowTimestampCol(boolean autoCommit) 
throws Exception {
-String tableName = 
"testDeleteForTableWithRowTimestampCol".toUpperCase();
+private void testDeleteForTableWithRowTimestampCol(boolean autoCommit, 
String tableName) throws Exception {
 try (Connection conn = DriverManager.getConnection(getUrl())) {
 conn.setAutoCommit(autoCommit);
 Statement stm = conn.createStatement();

http://git-wip-us.apache.org/repos/asf/phoenix/blob/27697b36/phoenix-core/src/it/java/org/apache/phoenix/end2end/PhoenixRuntimeIT.java
--
diff --git 
a/phoenix-co

[02/47] phoenix git commit: PHOENIX-2793 Test case for date-time functions on null dates return no data (Kevin Liew)

2016-09-20 Thread maryannxue
PHOENIX-2793 Test case for date-time functions on null dates return no data 
(Kevin Liew)


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

Branch: refs/heads/calcite
Commit: 06d37e534d1e07e8206eaefb82dd7bf3f50455b0
Parents: b7d45ca
Author: Samarth 
Authored: Thu Sep 1 10:28:49 2016 -0700
Committer: Samarth 
Committed: Thu Sep 1 10:28:49 2016 -0700

--
 .../it/java/org/apache/phoenix/end2end/DateTimeIT.java   | 11 +++
 1 file changed, 11 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/06d37e53/phoenix-core/src/it/java/org/apache/phoenix/end2end/DateTimeIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DateTimeIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DateTimeIT.java
index abdcf3b..227374a 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DateTimeIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DateTimeIT.java
@@ -794,4 +794,15 @@ public class DateTimeIT extends 
BaseHBaseManagedTimeTableReuseIT {
 assertEquals(false, rs.getBoolean(1));
 assertFalse(rs.next());
 }
+
+@Test
+public void testFunctionOnNullDate() throws Exception {
+ResultSet rs = conn.createStatement().executeQuery("SELECT 
YEAR(a_date), entity_id from " + this.tableName + " WHERE entity_id = '" + 
ROW10 + "'");
+assertNotNull(rs);
+assertTrue(rs.next());
+assertEquals(ROW10, rs.getString(2));
+assertNull(rs.getDate(1));
+assertNull(rs.getDate(1, GregorianCalendar.getInstance()));
+assertFalse(rs.next());
+}
 }



[16/47] phoenix git commit: PHOENIX-1367 VIEW derived from another VIEW doesn't use parent VIEW indexes

2016-09-20 Thread maryannxue
PHOENIX-1367 VIEW derived from another VIEW doesn't use parent VIEW indexes


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

Branch: refs/heads/calcite
Commit: 5a6496e1dc51576f4882c3718495eb2e1d6bce0a
Parents: 8e082fb
Author: Cody Marcel 
Authored: Mon Jul 18 17:58:32 2016 -0600
Committer: Thomas D'Silva 
Committed: Sun Sep 11 11:33:53 2016 -0700

--
 .../index/ChildViewsUseParentViewIndexIT.java   | 254 +++
 .../coprocessor/MetaDataEndpointImpl.java   |  14 +-
 .../apache/phoenix/index/IndexMaintainer.java   |  16 +-
 .../apache/phoenix/query/QueryConstants.java|   1 +
 .../apache/phoenix/schema/MetaDataClient.java   |  67 +++--
 .../apache/phoenix/schema/PMetaDataImpl.java|   2 +-
 .../java/org/apache/phoenix/schema/PTable.java  |  20 +-
 .../org/apache/phoenix/schema/PTableImpl.java   |  41 ++-
 .../org/apache/phoenix/util/ExpressionUtil.java |  15 +-
 9 files changed, 360 insertions(+), 70 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/5a6496e1/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ChildViewsUseParentViewIndexIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ChildViewsUseParentViewIndexIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ChildViewsUseParentViewIndexIT.java
new file mode 100644
index 000..60a428c
--- /dev/null
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ChildViewsUseParentViewIndexIT.java
@@ -0,0 +1,254 @@
+package org.apache.phoenix.end2end.index;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.sql.Connection;
+import java.sql.Date;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.Properties;
+
+import org.apache.phoenix.end2end.BaseHBaseManagedTimeTableReuseIT;
+import org.apache.phoenix.util.QueryUtil;
+import org.junit.Test;
+
+public class ChildViewsUseParentViewIndexIT extends 
BaseHBaseManagedTimeTableReuseIT {
+
+@Test
+public void testIndexOnParentViewWithTenantSpecificConnection() throws 
Exception {
+final String baseTableName = generateRandomString();
+final String globalViewName = generateRandomString();
+final String globalViewIdxName = generateRandomString();
+final String tenantViewName1 = generateRandomString();
+final String tenantViewName2 = generateRandomString();
+
+// Set up props with TenantId
+Properties props  = new Properties();
+props.setProperty("TenantId", "00Dxxx1");
+
+try (Connection conn = DriverManager.getConnection(getUrl());
+Connection tenantConn = DriverManager.getConnection(getUrl(), 
props)) {
+// Create Base table
+createBaseTable(baseTableName, conn);
+
+// Create the Global View on the Base Table for a value of KP
+createGlobalView(globalViewName, baseTableName, conn);
+
+// Create Global Index on View
+createGlobalIndexOnView(globalViewName, globalViewIdxName, conn);
+
+// Create tenant specific view which is a child of global view
+createTenantSpecificView(globalViewName, tenantViewName1, 
tenantConn);
+
+// Create tenant specific view which is a child of previous tenant 
view
+createTenantSpecificView(tenantViewName1, tenantViewName2, 
tenantConn);
+
+int rowCount = 0;
+insertRowIntoView(globalViewName, tenantConn, ++rowCount);
+insertRowIntoView(globalViewName, tenantConn, ++rowCount);
+insertRowIntoView(globalViewName, tenantConn, ++rowCount);
+assertQueryIndex(globalViewName, baseTableName, tenantConn, 3);
+
+insertRowIntoView(tenantViewName1, tenantConn, ++rowCount);
+insertRowIntoView(tenantViewName2, tenantConn, ++rowCount);
+
+// assert that we get 5 rows while querying via tenant specific 
views and that we use the index
+assertQueryIndex(tenantViewName1, baseTableName, tenantConn, 5);
+assertQueryIndex(tenantViewName2, baseTableName, tenantConn, 5);
+
+// assert that we get 5 rows while querying via global specific 
view and that we use the index
+assertQueryIndex(globalViewName, baseTableName, tenantConn, 5);
+}
+}
+
+
+@Test
+public

[10/47] phoenix git commit: PHOENIX-3255 Increase test coverage for TIMESTAMP (Kevin Liew)

2016-09-20 Thread maryannxue
PHOENIX-3255 Increase test coverage for TIMESTAMP (Kevin Liew)


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

Branch: refs/heads/calcite
Commit: d94d57183501526cff6fc1c5d1475e487c9c4653
Parents: 210445d
Author: James Taylor 
Authored: Thu Sep 8 09:39:31 2016 -0700
Committer: James Taylor 
Committed: Thu Sep 8 11:13:47 2016 -0700

--
 .../org/apache/phoenix/end2end/DateTimeIT.java  | 703 ++-
 1 file changed, 695 insertions(+), 8 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/d94d5718/phoenix-core/src/it/java/org/apache/phoenix/end2end/DateTimeIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DateTimeIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DateTimeIT.java
index 05a8ec8..fe02c57 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DateTimeIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DateTimeIT.java
@@ -39,14 +39,7 @@ import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
 import java.math.BigDecimal;
-import java.sql.Connection;
-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.Types;
+import java.sql.*;
 import java.text.Format;
 import java.util.Calendar;
 import java.util.GregorianCalendar;
@@ -850,4 +843,698 @@ public class DateTimeIT extends 
BaseHBaseManagedTimeTableReuseIT {
 assertNull(rs.getDate(1, GregorianCalendar.getInstance()));
 assertFalse(rs.next());
 }
+
+@Test
+public void testProjectedDateTimestampUnequal() throws Exception {
+String tableName = generateRandomString();
+String ddl =
+"CREATE TABLE IF NOT EXISTS " + tableName + " (k1 INTEGER 
PRIMARY KEY, dates DATE, timestamps TIMESTAMP)";
+conn.createStatement().execute(ddl);
+// Differ by date
+String dml = "UPSERT INTO " + tableName + " VALUES (1," +
+"TO_DATE('2004-02-04 00:10:10')," +
+"TO_TIMESTAMP('2006-04-12 00:10:10'))";
+conn.createStatement().execute(dml);
+// Differ by time
+dml = "UPSERT INTO " + tableName + " VALUES (2," +
+"TO_DATE('2004-02-04 00:10:10'), " +
+"TO_TIMESTAMP('2004-02-04 15:10:20'))";
+conn.createStatement().execute(dml);
+// Differ by nanoseconds
+PreparedStatement stmt = conn.prepareStatement("UPSERT INTO " + 
tableName + " VALUES (?, ?, ?)");
+stmt.setInt(1, 3);
+stmt.setDate(2, new Date(1000));
+Timestamp ts = new Timestamp(1000);
+ts.setNanos(100);
+stmt.setTimestamp(3, ts);
+stmt.execute();
+// Equality
+dml = "UPSERT INTO " + tableName + " VALUES (4," +
+"TO_DATE('2004-02-04 00:10:10'), " +
+"TO_TIMESTAMP('2004-02-04 00:10:10'))";
+conn.createStatement().execute(dml);
+conn.commit();
+
+ResultSet rs = conn.createStatement().executeQuery("SELECT dates = 
timestamps FROM " + tableName);
+assertTrue(rs.next());
+assertEquals(false, rs.getBoolean(1));
+assertTrue(rs.next());
+assertEquals(false, rs.getBoolean(1));
+assertTrue(rs.next());
+assertEquals(false, rs.getBoolean(1));
+assertTrue(rs.next());
+assertEquals(true, rs.getBoolean(1));
+assertFalse(rs.next());
+}
+
+@Test
+public void testProjectedTimeTimestampCompare() throws Exception {
+String tableName = generateRandomString();
+String ddl =
+"CREATE TABLE IF NOT EXISTS " + tableName + " (k1 INTEGER 
PRIMARY KEY, times TIME, timestamps TIMESTAMP)";
+conn.createStatement().execute(ddl);
+// Differ by date
+String dml = "UPSERT INTO " + tableName + " VALUES (1," +
+"TO_TIME('2004-02-04 00:10:10')," +
+"TO_TIMESTAMP('2006-04-12 00:10:10'))";
+conn.createStatement().execute(dml);
+// Differ by time
+dml = "UPSERT INTO " + tableName + " VALUES (2," +
+"TO_TIME('2004-02-04 00:10:10'), " +
+"TO_TIMESTAMP('2004-02-04 15:10:20'))";
+conn.createStatement().execute(dml);
+// Differ by nanoseconds
+PreparedStatement stmt = conn.prepareStatement("UPSERT INTO " + 
tableName + " VALUES (?, ?, ?)");
+stmt.setInt(1, 3);
+stmt.setTime(2, new Time(1000));
+Timestamp ts = new T

[07/47] phoenix git commit: PHOENIX-2785 Do not store NULLs for immutable tables.

2016-09-20 Thread maryannxue
PHOENIX-2785 Do not store NULLs for immutable tables.


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

Branch: refs/heads/calcite
Commit: 3a8724eee05aaf477bf6085415e781856990e1c0
Parents: b65e385
Author: Lars Hofhansl 
Authored: Wed Sep 7 14:03:56 2016 -0700
Committer: Lars Hofhansl 
Committed: Wed Sep 7 14:11:03 2016 -0700

--
 .../apache/phoenix/end2end/StoreNullsIT.java| 40 +++-
 .../org/apache/phoenix/schema/PTableImpl.java   | 13 ---
 2 files changed, 47 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/3a8724ee/phoenix-core/src/it/java/org/apache/phoenix/end2end/StoreNullsIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/StoreNullsIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/StoreNullsIT.java
index cbce02e..836418c 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/StoreNullsIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/StoreNullsIT.java
@@ -34,7 +34,6 @@ import org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.util.PhoenixRuntime;
 import org.apache.phoenix.util.SchemaUtil;
 import org.junit.After;
-import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
@@ -63,6 +62,8 @@ public class StoreNullsIT extends 
BaseHBaseManagedTimeTableReuseIT {
 private static final Log LOG = LogFactory.getLog(StoreNullsIT.class);
 private static final String WITH_NULLS = generateRandomString();
 private static final String WITHOUT_NULLS = generateRandomString();
+private static final String IMMUTABLE_WITH_NULLS = generateRandomString();
+private static final String IMMUTABLE_WITHOUT_NULLS = 
generateRandomString();
 
 private static Connection conn;
 private static Statement stmt;
@@ -81,6 +82,12 @@ public class StoreNullsIT extends 
BaseHBaseManagedTimeTableReuseIT {
 "id SMALLINT NOT NULL PRIMARY KEY, " +
 "name VARCHAR) " +
 "VERSIONS = 1000, KEEP_DELETED_CELLS = false");
+stmt.execute("CREATE TABLE " + IMMUTABLE_WITH_NULLS + " ("
++ "id SMALLINT NOT NULL PRIMARY KEY, name VARCHAR) "
++ "STORE_NULLS = true, VERSIONS = 1, KEEP_DELETED_CELLS = 
false, IMMUTABLE_ROWS=true");
+stmt.execute("CREATE TABLE " + IMMUTABLE_WITHOUT_NULLS + " ("
++ "id SMALLINT NOT NULL PRIMARY KEY, name VARCHAR) "
++ "VERSIONS = 1, KEEP_DELETED_CELLS = false, 
IMMUTABLE_ROWS=true");
 }
 
 @After
@@ -90,6 +97,37 @@ public class StoreNullsIT extends 
BaseHBaseManagedTimeTableReuseIT {
 }
 
 @Test
+public void testStoringNulls() throws SQLException, InterruptedException, 
IOException {
+stmt.executeUpdate("UPSERT INTO " + IMMUTABLE_WITH_NULLS + " VALUES 
(1, 'v1')");
+stmt.executeUpdate("UPSERT INTO " + IMMUTABLE_WITHOUT_NULLS + " VALUES 
(1, 'v1')");
+stmt.executeUpdate("UPSERT INTO " + IMMUTABLE_WITH_NULLS + " VALUES 
(2, null)");
+stmt.executeUpdate("UPSERT INTO " + IMMUTABLE_WITHOUT_NULLS + " VALUES 
(2, null)");
+
+ensureNullsNotStored(IMMUTABLE_WITH_NULLS);
+ensureNullsNotStored(IMMUTABLE_WITHOUT_NULLS);
+}
+
+private void ensureNullsNotStored(String tableName) throws IOException {
+tableName = SchemaUtil.normalizeIdentifier(tableName);
+HTable htable = new HTable(getUtility().getConfiguration(), tableName);
+Scan s = new Scan();
+s.setRaw(true);
+ResultScanner scanner = htable.getScanner(s);
+// first row has a value for name
+Result rs = scanner.next();
+
assertTrue(rs.containsColumn(QueryConstants.DEFAULT_COLUMN_FAMILY_BYTES, 
Bytes.toBytes("NAME")));
+assertTrue(rs.size() == 2);
+// 2nd row has not
+rs = scanner.next();
+
assertFalse(rs.containsColumn(QueryConstants.DEFAULT_COLUMN_FAMILY_BYTES, 
Bytes.toBytes("NAME")));
+// and no delete marker either
+assertTrue(rs.size() == 1);
+assertNull(scanner.next());
+scanner.close();
+htable.close();
+}
+
+@Test
 public void testQueryingHistory() throws SQLException, 
InterruptedException, IOException {
 stmt.executeUpdate("UPSERT INTO " + WITH_NULLS + " VALUES (1, 'v1')");
 stmt.executeUpdate("UPSERT INTO " + WITHOUT_NULLS + " VALUES (1, 
'v1')");

http://git-wip-us.apache.org/repos/asf/phoenix/blob/3a8724ee/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java
--

[39/47] phoenix git commit: PHOENIX-3291 Do not throw return value of Throwables#propagate call

2016-09-20 Thread maryannxue
PHOENIX-3291 Do not throw return value of Throwables#propagate call


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

Branch: refs/heads/calcite
Commit: 553a5871e3c8e2277cebd9f2561b1f2899d1e6d5
Parents: 4c8bda1
Author: James Taylor 
Authored: Fri Sep 16 21:25:00 2016 -0700
Committer: James Taylor 
Committed: Sat Sep 17 00:07:28 2016 -0700

--
 .../main/java/org/apache/phoenix/jdbc/PhoenixStatement.java| 6 --
 .../apache/phoenix/mapreduce/FormatToBytesWritableMapper.java  | 3 ++-
 .../org/apache/phoenix/query/ConnectionQueryServicesImpl.java  | 2 +-
 .../main/java/org/apache/phoenix/util/CSVCommonsLoader.java| 2 +-
 .../java/org/apache/phoenix/util/PhoenixContextExecutor.java   | 6 +++---
 5 files changed, 11 insertions(+), 8 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/553a5871/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixStatement.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixStatement.java 
b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixStatement.java
index 0c154e2..0fbc81a 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixStatement.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixStatement.java
@@ -314,7 +314,8 @@ public class PhoenixStatement implements Statement, 
SQLCloseable {
 }, PhoenixContextExecutor.inContext());
 } catch (Exception e) {
 Throwables.propagateIfInstanceOf(e, SQLException.class);
-throw Throwables.propagate(e);
+Throwables.propagate(e);
+throw new IllegalStateException(); // Can't happen as 
Throwables.propagate() always throws
 }
 }
 
@@ -367,7 +368,8 @@ public class PhoenixStatement implements Statement, 
SQLCloseable {
 Tracing.withTracing(connection, this.toString()));
 } catch (Exception e) {
 Throwables.propagateIfInstanceOf(e, SQLException.class);
-throw Throwables.propagate(e);
+Throwables.propagate(e);
+throw new IllegalStateException(); // Can't happen as 
Throwables.propagate() always throws
 }
 }
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/553a5871/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/FormatToBytesWritableMapper.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/FormatToBytesWritableMapper.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/FormatToBytesWritableMapper.java
index cacbce7..b12326a 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/FormatToBytesWritableMapper.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/FormatToBytesWritableMapper.java
@@ -28,6 +28,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 import java.util.TreeMap;
+
 import javax.annotation.Nullable;
 
 import org.apache.hadoop.conf.Configuration;
@@ -379,7 +380,7 @@ public abstract class FormatToBytesWritableMapper 
extends Mapperhttp://git-wip-us.apache.org/repos/asf/phoenix/blob/553a5871/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 767a600..1aa9b88 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
@@ -2786,7 +2786,7 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 });
 } catch (Exception e) {
 Throwables.propagateIfInstanceOf(e, SQLException.class);
-throw Throwables.propagate(e);
+Throwables.propagate(e);
 }
 }
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/553a5871/phoenix-core/src/main/java/org/apache/phoenix/util/CSVCommonsLoader.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/util/CSVCommonsLoader.java 
b/phoenix-core/src/main/java/org/apache/phoenix/util/CSVCommonsLoader.java
index cdd9d7b..23f123e 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/CSVCommonsLoader.java
+++ b/phoenix-core/src/main/java/org

[25/47] phoenix git commit: PHOENIX-3072 Deadlock on region opening with secondary index recovery (Enis Soztutar)

2016-09-20 Thread maryannxue
http://git-wip-us.apache.org/repos/asf/phoenix/blob/2c2b552c/phoenix-core/src/main/java/org/apache/phoenix/query/QueryConstants.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/query/QueryConstants.java 
b/phoenix-core/src/main/java/org/apache/phoenix/query/QueryConstants.java
index 155d1ba..ace228b 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/query/QueryConstants.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/query/QueryConstants.java
@@ -168,6 +168,11 @@ public interface QueryConstants {
 
 public static final byte[] TRUE = new byte[] {1};
 
+/**
+ * The priority property for an hbase table. This is already in HTD, but 
older versions of
+ * HBase do not have this, so we re-defined it here. Once Phoenix is 
HBase-1.3+, we can remote.
+ */
+public static final String PRIORITY = "PRIORITY";
 
 /**
  * Separator used between variable length keys for a composite key.

http://git-wip-us.apache.org/repos/asf/phoenix/blob/2c2b552c/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
index 7da7010..28ed11d 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
@@ -228,168 +228,168 @@ public class MetaDataClient {
 private static final ParseNodeFactory FACTORY = new ParseNodeFactory();
 private static final String SET_ASYNC_CREATED_DATE =
 "UPSERT INTO " + SYSTEM_CATALOG_SCHEMA + ".\"" + 
SYSTEM_CATALOG_TABLE + "\"( " +
-TENANT_ID + "," +
-TABLE_SCHEM + "," +
-TABLE_NAME + "," +
-ASYNC_CREATED_DATE + " " + PDate.INSTANCE.getSqlTypeName() +
-") VALUES (?, ?, ?, ?)";
+TENANT_ID + "," +
+TABLE_SCHEM + "," +
+TABLE_NAME + "," +
+ASYNC_CREATED_DATE + " " + PDate.INSTANCE.getSqlTypeName() 
+
+") VALUES (?, ?, ?, ?)";
 private static final String CREATE_TABLE =
 "UPSERT INTO " + SYSTEM_CATALOG_SCHEMA + ".\"" + 
SYSTEM_CATALOG_TABLE + "\"( " +
-TENANT_ID + "," +
-TABLE_SCHEM + "," +
-TABLE_NAME + "," +
-TABLE_TYPE + "," +
-TABLE_SEQ_NUM + "," +
-COLUMN_COUNT + "," +
-SALT_BUCKETS + "," +
-PK_NAME + "," +
-DATA_TABLE_NAME + "," +
-INDEX_STATE + "," +
-IMMUTABLE_ROWS + "," +
-DEFAULT_COLUMN_FAMILY_NAME + "," +
-VIEW_STATEMENT + "," +
-DISABLE_WAL + "," +
-MULTI_TENANT + "," +
-VIEW_TYPE + "," +
-VIEW_INDEX_ID + "," +
-INDEX_TYPE + "," +
-STORE_NULLS + "," +
-BASE_COLUMN_COUNT + "," +
-TRANSACTIONAL + "," +
-UPDATE_CACHE_FREQUENCY + "," +
-IS_NAMESPACE_MAPPED + "," +
-AUTO_PARTITION_SEQ +  "," +
-APPEND_ONLY_SCHEMA +
-") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 
?, ?, ?, ?, ?, ?, ?)";
+TENANT_ID + "," +
+TABLE_SCHEM + "," +
+TABLE_NAME + "," +
+TABLE_TYPE + "," +
+TABLE_SEQ_NUM + "," +
+COLUMN_COUNT + "," +
+SALT_BUCKETS + "," +
+PK_NAME + "," +
+DATA_TABLE_NAME + "," +
+INDEX_STATE + "," +
+IMMUTABLE_ROWS + "," +
+DEFAULT_COLUMN_FAMILY_NAME + "," +
+VIEW_STATEMENT + "," +
+DISABLE_WAL + "," +
+MULTI_TENANT + "," +
+VIEW_TYPE + "," +
+VIEW_INDEX_ID + "," +
+INDEX_TYPE + "," +
+STORE_NULLS + "," +
+BASE_COLUMN_COUNT + "," +
+TRANSACTIONAL + "," +
+UPDATE_CACHE_FREQUENCY + "," +
+IS_NAMESPACE_MAPPED + "," +
+AUTO_PARTITION_SEQ +  "," +
+APPEND_ONLY_SCHEMA +
+") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 
?, ?, ?, ?, ?, ?, ?, ?, ?)";
 
 private static final String CREATE_SCHEMA = "UPSERT INTO " + 
SYSTEM_CATALOG_SCHEMA + ".\"" + SYSTEM_CATALOG_TABLE
 + "\"( " + TABLE_SCHEM + "," + TABLE_NAME + ") VALUES (?,?)";
 
 private static final String CREATE_LINK =
 "UPSERT INTO " + SYSTEM_CATALOG_SCHEMA + ".\"" + 
SYSTEM_CATALOG_TABLE + "\"( " +
-TEN

[44/47] phoenix git commit: PHOENIX-3174 Make minor upgrade a manual step

2016-09-20 Thread maryannxue
PHOENIX-3174 Make minor upgrade a manual step


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

Branch: refs/heads/calcite
Commit: e90feaa31bd928645ecc3596437b822d980939ed
Parents: e8ffc9c
Author: Samarth 
Authored: Mon Sep 19 18:31:49 2016 -0700
Committer: Samarth 
Committed: Mon Sep 19 18:31:49 2016 -0700

--
 .../org/apache/phoenix/end2end/UpgradeIT.java   | 156 ++-
 phoenix-core/src/main/antlr3/PhoenixSQL.g   |  10 +-
 .../coprocessor/MetaDataEndpointImpl.java   |  16 +-
 .../coprocessor/MetaDataRegionObserver.java |  47 +-
 .../phoenix/exception/SQLExceptionCode.java |   2 +
 .../exception/UpgradeInProgressException.java   |  28 +
 .../exception/UpgradeNotRequiredException.java  |  27 +
 .../exception/UpgradeRequiredException.java |  29 +
 .../apache/phoenix/jdbc/PhoenixConnection.java  |  27 +-
 .../phoenix/jdbc/PhoenixDatabaseMetaData.java   |   2 +-
 .../apache/phoenix/jdbc/PhoenixStatement.java   |  72 +-
 .../index/automation/PhoenixMRJobSubmitter.java |   4 +
 .../phoenix/parse/ExecuteUpgradeStatement.java  |  34 +
 .../apache/phoenix/parse/ParseNodeFactory.java  |   4 +
 .../phoenix/query/ConnectionQueryServices.java  |   3 +
 .../query/ConnectionQueryServicesImpl.java  | 951 ++-
 .../query/ConnectionlessQueryServicesImpl.java  |   8 +
 .../query/DelegateConnectionQueryServices.java  |  10 +
 .../org/apache/phoenix/query/QueryServices.java |   1 +
 .../phoenix/query/QueryServicesOptions.java |   5 +-
 .../apache/phoenix/schema/MetaDataClient.java   |   2 +-
 .../phoenix/trace/PhoenixMetricsSink.java   |  37 +-
 .../org/apache/phoenix/util/PhoenixRuntime.java |   2 +-
 .../java/org/apache/phoenix/util/QueryUtil.java |   6 +-
 .../org/apache/phoenix/util/UpgradeUtil.java|  19 +-
 25 files changed, 1027 insertions(+), 475 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/e90feaa3/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpgradeIT.java
--
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpgradeIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpgradeIT.java
index b47738d..bdd94a2 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpgradeIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpgradeIT.java
@@ -24,7 +24,9 @@ import static 
org.apache.phoenix.query.QueryConstants.DIVERGED_VIEW_BASE_COLUMN_
 import static 
org.apache.phoenix.util.UpgradeUtil.SELECT_BASE_COLUMN_COUNT_FROM_HEADER_ROW;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 import java.io.IOException;
 import java.sql.Connection;
@@ -33,6 +35,9 @@ import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.util.Properties;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
@@ -41,8 +46,14 @@ import org.apache.hadoop.hbase.client.Put;
 import org.apache.hadoop.hbase.client.RowMutations;
 import org.apache.hadoop.hbase.snapshot.SnapshotCreationException;
 import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.phoenix.coprocessor.MetaDataProtocol;
+import org.apache.phoenix.exception.UpgradeInProgressException;
+import org.apache.phoenix.exception.UpgradeRequiredException;
 import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
+import org.apache.phoenix.query.ConnectionQueryServices;
+import org.apache.phoenix.query.ConnectionQueryServicesImpl;
+import org.apache.phoenix.query.DelegateConnectionQueryServices;
 import org.apache.phoenix.query.QueryConstants;
 import org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.schema.PName;
@@ -51,7 +62,6 @@ import org.apache.phoenix.util.MetaDataUtil;
 import org.apache.phoenix.util.PhoenixRuntime;
 import org.apache.phoenix.util.SchemaUtil;
 import org.apache.phoenix.util.UpgradeUtil;
-import org.junit.Ignore;
 import org.junit.Test;
 
 public class UpgradeIT extends BaseHBaseManagedTimeIT {
@@ -576,6 +586,150 @@ public class UpgradeIT extends BaseHBaseManagedTimeIT {
 }
 }
 }
+
+@Test
+public void testUpgradeRequiredPreventsSQL() throws SQLException {
+String tableName = generateRandomString();
+try (Connect

[45/47] phoenix git commit: PHOENIX-3302 Use unique names for views and indexes in GlobalIndexOptimizationIT

2016-09-20 Thread maryannxue
PHOENIX-3302 Use unique names for views and indexes in GlobalIndexOptimizationIT


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

Branch: refs/heads/calcite
Commit: 0a05d67f1785bba2ca333f281b4d7650a05c6ee0
Parents: e90feaa
Author: Samarth 
Authored: Mon Sep 19 19:49:15 2016 -0700
Committer: Samarth 
Committed: Mon Sep 19 19:49:15 2016 -0700

--
 .../end2end/index/GlobalIndexOptimizationIT.java | 15 +--
 1 file changed, 9 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/0a05d67f/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/GlobalIndexOptimizationIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/GlobalIndexOptimizationIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/GlobalIndexOptimizationIT.java
index b84cf5d..af2ddaa 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/GlobalIndexOptimizationIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/GlobalIndexOptimizationIT.java
@@ -333,21 +333,24 @@ public class GlobalIndexOptimizationIT extends 
ParallelStatsDisabledIT {
 String dataTableName = generateRandomString();
 createBaseTable(dataTableName, null, "('e','i','o')", false);
 Connection conn1 = DriverManager.getConnection(getUrl());
+String viewName = generateRandomString();
+String indexOnDataTable = generateRandomString();
 try{
-conn1.createStatement().execute("CREATE INDEX i1 ON " + 
dataTableName + "(k2,k1) INCLUDE (v1)");
-conn1.createStatement().execute("CREATE VIEW v AS SELECT * FROM " 
+ dataTableName + " WHERE v1 = 'a'");
+conn1.createStatement().execute("CREATE INDEX " + indexOnDataTable 
+ " ON " + dataTableName + "(k2,k1) INCLUDE (v1)");
+conn1.createStatement().execute("CREATE VIEW " + viewName  + " AS 
SELECT * FROM " + dataTableName + " WHERE v1 = 'a'");
 conn1.createStatement().execute("UPSERT INTO " + dataTableName + " 
values('b',1,2,4,'z')");
 conn1.createStatement().execute("UPSERT INTO " + dataTableName + " 
values('f',1,2,3,'a')");
 conn1.createStatement().execute("UPSERT INTO " + dataTableName + " 
values('j',2,4,2,'a')");
 conn1.createStatement().execute("UPSERT INTO " + dataTableName + " 
values('q',3,1,1,'c')");
 conn1.commit();
-ResultSet rs = conn1.createStatement().executeQuery("SELECT 
COUNT(*) FROM v");
+ResultSet rs = conn1.createStatement().executeQuery("SELECT 
COUNT(*) FROM " + viewName);
 assertTrue(rs.next());
 assertEquals(2, rs.getInt(1));
 assertFalse(rs.next());
-conn1.createStatement().execute("CREATE INDEX vi1 ON v(k1)");
+String viewIndex = generateRandomString();
+conn1.createStatement().execute("CREATE INDEX " + viewIndex + " ON 
" + viewName + " (k1)");
 
-String query = "SELECT /*+ INDEX(v vi1)*/ t_id,k1,k2,k3,v1 FROM v 
where k1 IN (1,2) and k2 IN (3,4)";
+String query = "SELECT /*+ INDEX(" + viewName + " " + viewIndex + 
")*/ t_id,k1,k2,k3,v1 FROM " + viewName + " where k1 IN (1,2) and k2 IN (3,4)";
 rs = conn1.createStatement().executeQuery("EXPLAIN "+ query);
 
 String actual = QueryUtil.getExplainPlan(rs);
@@ -357,7 +360,7 @@ public class GlobalIndexOptimizationIT extends 
ParallelStatsDisabledIT {
 "SKIP-SCAN-JOIN TABLE 0\n" +
 "CLIENT PARALLEL 1-WAY SKIP SCAN ON 2 KEYS OVER 
_IDX_" + dataTableName + " \\[-32768,1\\] - \\[-32768,2\\]\n" +
 "SERVER FILTER BY FIRST KEY ONLY AND \"K2\" IN 
\\(3,4\\)\n" +
-"DYNAMIC SERVER FILTER BY \\(\"V.T_ID\", \"V.K1\", 
\"V.K2\"\\) IN \\(\\(\\$\\d+.\\$\\d+, \\$\\d+.\\$\\d+, \\$\\d+.\\$\\d+\\)\\)";
+"DYNAMIC SERVER FILTER BY \\(\"" + viewName + 
".T_ID\", \"" + viewName + ".K1\", \"" + viewName + ".K2\"\\) IN 
\\(\\(\\$\\d+.\\$\\d+, \\$\\d+.\\$\\d+, \\$\\d+.\\$\\d+\\)\\)";
 assertTrue("Expected:\n" + expected + "\ndid not match\n" + 
actual, Pattern.matches(expected,actual));
 
 rs = conn1.createStatement().executeQuery(query);



[31/47] phoenix git commit: PHOENIX-3253 Make changes to BaseHBaseTimeManagedIT tests to support method level parallelization

2016-09-20 Thread maryannxue
PHOENIX-3253 Make changes to BaseHBaseTimeManagedIT tests to support method 
level parallelization


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

Branch: refs/heads/calcite
Commit: 1a3bd43a595f3ba23db823486f476c31e890b3d2
Parents: a4ebcfd
Author: James Taylor 
Authored: Thu Sep 15 15:57:38 2016 -0700
Committer: James Taylor 
Committed: Thu Sep 15 15:57:38 2016 -0700

--
 .../phoenix/trace/PhoenixTracingEndToEndIT.java | 27 ++--
 .../org/apache/phoenix/tx/TransactionIT.java|  5 ++--
 2 files changed, 17 insertions(+), 15 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/1a3bd43a/phoenix-core/src/it/java/org/apache/phoenix/trace/PhoenixTracingEndToEndIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/trace/PhoenixTracingEndToEndIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/trace/PhoenixTracingEndToEndIT.java
index 2e21846..d6ca23b 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/trace/PhoenixTracingEndToEndIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/trace/PhoenixTracingEndToEndIT.java
@@ -44,7 +44,6 @@ import org.apache.htrace.impl.ProbabilitySampler;
 import org.apache.phoenix.coprocessor.BaseScannerRegionObserver;
 import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.metrics.Metrics;
-import org.apache.phoenix.query.QueryServicesOptions;
 import org.apache.phoenix.trace.TraceReader.SpanInfo;
 import org.apache.phoenix.trace.TraceReader.TraceHolder;
 import org.junit.After;
@@ -61,8 +60,8 @@ public class PhoenixTracingEndToEndIT extends 
BaseTracingTestIT {
 
 private static final Log LOG = 
LogFactory.getLog(PhoenixTracingEndToEndIT.class);
 private static final int MAX_RETRIES = 10;
-private final String table = "ENABLED_FOR_LOGGING";
-private final String index = "ENABALED_FOR_LOGGING_INDEX";
+private String enabledForLoggingTable;
+private String enableForLoggingIndex;
 
 private DisableableMetricsWriter sink;
 private String tableName;
@@ -74,6 +73,8 @@ public class PhoenixTracingEndToEndIT extends 
BaseTracingTestIT {
 tableName = generateRandomString();
 pWriter.initForTesting(conn, tableName);
 sink = new DisableableMetricsWriter(pWriter);
+enabledForLoggingTable = "ENABLED_FOR_LOGGING_" + 
generateRandomString();
+enableForLoggingIndex = "ENABALED_FOR_LOGGING_INDEX" + 
generateRandomString();
 
 TracingTestUtil.registerSink(sink);
 }
@@ -184,7 +185,7 @@ public class PhoenixTracingEndToEndIT extends 
BaseTracingTestIT {
 // trace the requests we send
 Connection traceable = getTracingConnection();
 LOG.debug("Doing dummy the writes to the tracked table");
-String insert = "UPSERT INTO " + table + " VALUES (?, ?)";
+String insert = "UPSERT INTO " + enabledForLoggingTable + " VALUES (?, 
?)";
 PreparedStatement stmt = traceable.prepareStatement(insert);
 stmt.setString(1, "key1");
 stmt.setLong(2, 1);
@@ -222,7 +223,7 @@ public class PhoenixTracingEndToEndIT extends 
BaseTracingTestIT {
 public boolean foundTrace(TraceHolder trace, SpanInfo span) {
 String traceInfo = trace.toString();
 // skip logging traces that are just traces about tracing
-if 
(traceInfo.contains(QueryServicesOptions.DEFAULT_TRACING_STATS_TABLE_NAME)) {
+if (traceInfo.contains(tableName)) {
 return false;
 }
 return traceInfo.contains("Completing index");
@@ -235,7 +236,7 @@ public class PhoenixTracingEndToEndIT extends 
BaseTracingTestIT {
 private void createTestTable(Connection conn, boolean withIndex) throws 
SQLException {
 // create a dummy table
 String ddl =
-"create table if not exists " + table + "(" + "k varchar not 
null, " + "c1 bigint"
+"create table if not exists " + enabledForLoggingTable + "(" + 
"k varchar not null, " + "c1 bigint"
 + " CONSTRAINT pk PRIMARY KEY (k))";
 conn.createStatement().execute(ddl);
 
@@ -244,7 +245,7 @@ public class PhoenixTracingEndToEndIT extends 
BaseTracingTestIT {
 return;
 }
 // create an index on the table - we know indexing has some basic 
tracing
-ddl = "CREATE INDEX IF NOT EXISTS " + index + " on " + table + " (c1)";
+ddl = "CREATE INDEX IF NOT EXISTS " + enableForLoggingIndex + " on " + 
enabledForLoggingTable + " (c1)";
 conn.createStatemen

[15/47] phoenix git commit: PHOENIX-3230 Addendum to use the physical name of system catalog and other tweaks/cleanup

2016-09-20 Thread maryannxue
PHOENIX-3230 Addendum to use the physical name of system catalog and other 
tweaks/cleanup


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

Branch: refs/heads/calcite
Commit: 8e082fb5bbace7a495c5b727b2f781bba3b67cd1
Parents: d9eb45e
Author: Samarth 
Authored: Fri Sep 9 14:44:46 2016 -0700
Committer: Samarth 
Committed: Fri Sep 9 14:44:46 2016 -0700

--
 .../phoenix/coprocessor/MetaDataProtocol.java   |  3 ++-
 .../query/ConnectionQueryServicesImpl.java  | 27 ++--
 .../apache/phoenix/query/QueryConstants.java|  2 +-
 3 files changed, 17 insertions(+), 15 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/8e082fb5/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
index 20922e5..3b57981 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
@@ -83,8 +83,9 @@ public abstract class MetaDataProtocol extends 
MetaDataService {
 public static final long MIN_SYSTEM_TABLE_TIMESTAMP_4_6_0 = 
MIN_TABLE_TIMESTAMP + 9;
 public static final long MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0 = 
MIN_TABLE_TIMESTAMP + 15;
 public static final long MIN_SYSTEM_TABLE_TIMESTAMP_4_8_0 = 
MIN_TABLE_TIMESTAMP + 18;
+public static final long MIN_SYSTEM_TABLE_TIMESTAMP_4_8_1 = 
MIN_TABLE_TIMESTAMP + 18;
 // MIN_SYSTEM_TABLE_TIMESTAMP needs to be set to the max of all the 
MIN_SYSTEM_TABLE_TIMESTAMP_* constants
-public static final long MIN_SYSTEM_TABLE_TIMESTAMP = 
MIN_SYSTEM_TABLE_TIMESTAMP_4_8_0;
+public static final long MIN_SYSTEM_TABLE_TIMESTAMP = 
MIN_SYSTEM_TABLE_TIMESTAMP_4_8_1;
 
 // ALWAYS update this map whenever rolling out a new release (major, minor 
or patch release). 
 // Key is the SYSTEM.CATALOG timestamp for the version and value is the 
version string.

http://git-wip-us.apache.org/repos/asf/phoenix/blob/8e082fb5/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 c5d53c3..607ad5e 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
@@ -19,7 +19,7 @@ package org.apache.phoenix.query;
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
 import static org.apache.hadoop.hbase.HColumnDescriptor.TTL;
 import static 
org.apache.phoenix.coprocessor.MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP;
-import static 
org.apache.phoenix.coprocessor.MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_8_0;
+import static 
org.apache.phoenix.coprocessor.MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_8_1;
 import static 
org.apache.phoenix.coprocessor.MetaDataProtocol.PHOENIX_MAJOR_VERSION;
 import static 
org.apache.phoenix.coprocessor.MetaDataProtocol.PHOENIX_MINOR_VERSION;
 import static 
org.apache.phoenix.coprocessor.MetaDataProtocol.PHOENIX_PATCH_NUMBER;
@@ -2329,7 +2329,7 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 if (upgradeSystemTables) {
 long currentServerSideTableTimeStamp = 
e.getTable().getTimeStamp();
 sysCatalogTableName = 
e.getTable().getPhysicalName().getString();
-if (currentServerSideTableTimeStamp < 
MIN_SYSTEM_TABLE_TIMESTAMP && 
acquireUpgradeMutex(currentServerSideTableTimeStamp)) {
+if (currentServerSideTableTimeStamp < 
MIN_SYSTEM_TABLE_TIMESTAMP && 
acquireUpgradeMutex(currentServerSideTableTimeStamp, 
e.getTable().getPhysicalName().getBytes())) {
 snapshotName = 
getUpgradeSnapshotName(sysCatalogTableName, currentServerSideTableTimeStamp);
 createSnapshot(snapshotName, 
sysCatalogTableName);
 }
@@ -2727,9 +2727,9 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
  * making use of HBas

Build failed in Jenkins: Phoenix-Calcite #11

2016-09-20 Thread Apache Jenkins Server
See 

Changes:

[maryannxue] PHOENIX-3303 Handle Date/Time/Timestamp objects and interval types 
in

--
[...truncated 13254 lines...]
  QueryCompilerTest.testNotOrderByOrderPreserving:1819 » SQL Error while 
executi...
  QueryCompilerTest.testNullInScanKey:498->compileQuery:450->getQueryPlan:464 » 
SQL
  
QueryCompilerTest.testOnlyNullInScanKey:510->compileQuery:450->getQueryPlan:464 
» SQL
  QueryCompilerTest.testOrderByOrderPreservingFwd:1775 » SQL Error while 
executi...
  QueryCompilerTest.testOrderByOrderPreservingRev:1800 » SQL Error while 
executi...
  QueryCompilerTest.testOrderByWithNoProjection:2313 » SQL Error while 
executing...
  
QueryCompilerTest.testPlanForOrderByOrGroupByNotUseRoundRobin:1960->testOrderByOrGroupByDoesntUseRoundRobin:1966
 » SQL
  QueryCompilerTest.testProjection:2272 » SQL Error while executing SQL "CREATE 
...
  
QueryCompilerTest.testRTrimSetScanKey:1033->compileQuery:450->getQueryPlan:464 
» SQL
  QueryCompilerTest.testRegex:1649 » SQL Error while executing SQL "CREATE 
TABLE...
  
QueryCompilerTest.testRegexpSubstrSetScanKeys:908->compileQuery:450->getQueryPlan:464
 » SQL
  QueryCompilerTest.testSaltTableJoin:2394 ClassCast 
org.apache.calcite.jdbc.Pho...
  QueryCompilerTest.testSelectColumnsInOneFamily:1994 » SQL Error while 
executin...
  QueryCompilerTest.testSelectColumnsInOneFamilyWithSchema:2014 » SQL Error 
whil...
  QueryCompilerTest.testServerArrayElementProjection1:2091 » SQL Error while 
exe...
  QueryCompilerTest.testServerArrayElementProjection2:2104 » SQL Error while 
exe...
  QueryCompilerTest.testServerArrayElementProjection3:2117 » SQL Error while 
exe...
  QueryCompilerTest.testServerArrayElementProjection4:2130 » SQL Error while 
exe...
  QueryCompilerTest.testServerArrayElementProjection5:2143 » SQL Error while 
exe...
  QueryCompilerTest.testServerArrayElementProjectionWithArrayPrimaryKey:2156 » 
SQL
  
QueryCompilerTest.testSubstrSetScanKey:1023->compileQuery:450->getQueryPlan:464 
» SQL
  QueryCompilerTest.testTableAliasMatchesCFName:779 » SQL Error while preparing 
...
  QueryCompilerTest.testUnknownColumnInPKConstraint:1180 » SQL Error while 
execu...
  QueryCompilerTest.testUseRoundRobinIterator:1916 » SQL Error while executing 
S...
  QueryCompilerTest.testVarBinaryNotLastInMultipartPK:186 » SQL
  QueryMetaDataTest.testBasicResultSetMetaData:306 » SQL Error while preparing 
s...
  QueryMetaDataTest.testCaseInsensitive:60 » SQL Error while preparing 
statement...
  QueryMetaDataTest.testCaseMetaData:171 » SQL Error while preparing statement 
[...
  QueryMetaDataTest.testCoerceToDecimalArithmeticMetaData:280 » SQL Error while 
...
  QueryMetaDataTest.testDateAdditionExpressionMetaData1:258 » SQL Error while 
pr...
  QueryMetaDataTest.testDateAdditionExpressionMetaData2:268 » SQL Error while 
pr...
  QueryMetaDataTest.testDateSubstractExpressionMetaData1:211 » SQL Error while 
p...
  QueryMetaDataTest.testDateSubstractExpressionMetaData2:221 » SQL Error while 
p...
  QueryMetaDataTest.testDateSubstractExpressionMetaData3:234 » SQL Error while 
p...
  QueryMetaDataTest.testInListParameterMetaData1:128 » SQL Error while 
preparing...
  QueryMetaDataTest.testInListParameterMetaData2:139 » SQL Error while 
preparing...
  QueryMetaDataTest.testInListParameterMetaData3:149 » SQL Error while 
preparing...
  QueryMetaDataTest.testInListParameterMetaData4:159 » SQL Error while 
preparing...
  QueryMetaDataTest.testKeyPrefixParameterMetaData:201 » SQL Error while 
prepari...
  QueryMetaDataTest.testLimitParameterMetaData:106 » SQL Error while preparing 
s...
  QueryMetaDataTest.testLongArithmeticMetaData:294 » SQL Error while preparing 
s...
  QueryMetaDataTest.testNoParameterMetaData:51 » SQL Error while preparing 
state...
  
QueryMetaDataTest.testNonEqualityRowValueConstructorBindParamMetaDataWithBindArgsOnRHSAndLiteralExprOnLHS:426
 » SQL
  QueryMetaDataTest.testParameterMetaData:69 » SQL Error while preparing 
stateme...
  QueryMetaDataTest.testRoundParameterMetaData:117 » SQL Error while preparing 
s...
  QueryMetaDataTest.testRowValueConstructorBindParamMetaData:347 » SQL Error 
whi...
  
QueryMetaDataTest.testRowValueConstructorBindParamMetaDataWithBindArgsAtDiffPlacesOnLHSRHS:393
 » SQL
  
QueryMetaDataTest.testRowValueConstructorBindParamMetaDataWithBindArgsAtSamePlacesOnLHSRHS:382
 » SQL
  
QueryMetaDataTest.testRowValueConstructorBindParamMetaDataWithBindArgsOnRHSAndLiteralExprOnLHS:415
 » SQL
  
QueryMetaDataTest.testRowValueConstructorBindParamMetaDataWithLessNumberOfBindArgs:371
 » SQL
  
QueryMetaDataTest.testRowValueConstructorBindParamMetaDataWithMoreNumberOfBindArgs:359
 » SQL
  QueryMetaDataTest.testStringConcatMetaData:335 » SQL Error while preparing 
sta...
  QueryMetaDataTest.testSubstrParameterMetaData:189 » SQL Error while preparing 
...
  QueryMetaDataTest.testToDateFunctionMetaData:96 » SQL Error while preparing 
st...
  QueryMetaDa

phoenix git commit: PHOENIX-3303 Handle Date/Time/Timestamp objects and interval types in RexNode-to-Expression translation

2016-09-20 Thread maryannxue
Repository: phoenix
Updated Branches:
  refs/heads/calcite faff90afd -> b8c8a4f50


PHOENIX-3303 Handle Date/Time/Timestamp objects and interval types in 
RexNode-to-Expression translation


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

Branch: refs/heads/calcite
Commit: b8c8a4f5076a3ef8c841141a38d3ce641503fc48
Parents: faff90a
Author: maryannxue 
Authored: Tue Sep 20 10:33:57 2016 -0700
Committer: maryannxue 
Committed: Tue Sep 20 10:33:57 2016 -0700

--
 .../main/java/org/apache/phoenix/calcite/CalciteUtils.java| 7 +++
 1 file changed, 7 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/b8c8a4f5/phoenix-core/src/main/java/org/apache/phoenix/calcite/CalciteUtils.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/calcite/CalciteUtils.java 
b/phoenix-core/src/main/java/org/apache/phoenix/calcite/CalciteUtils.java
index 8bce4cd..668da12 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/calcite/CalciteUtils.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/calcite/CalciteUtils.java
@@ -1,7 +1,9 @@
 package org.apache.phoenix.calcite;
 
 import java.sql.SQLException;
+import java.sql.Timestamp;
 import java.util.Arrays;
+import java.util.GregorianCalendar;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.atomic.AtomicInteger;
@@ -128,6 +130,9 @@ public class CalciteUtils {
 if (isArrayType) {
 sqlTypeName = ((ArraySqlType) 
relDataType).getComponentType().getSqlTypeName();
 }
+if (SqlTypeName.INTERVAL_TYPES.contains(sqlTypeName)) {
+sqlTypeName = SqlTypeName.DECIMAL;
+}
 final int ordinal = sqlTypeName.getJdbcOrdinal();
 if (ordinal >= PDataType.ARRAY_TYPE_BASE) {
 throw new UnsupportedOperationException(
@@ -605,6 +610,8 @@ public class CalciteUtils {
o = ((NlsString) o).getValue();
} else if (o instanceof ByteString) {
o = ((ByteString) o).getBytes();
+   } else if (o instanceof GregorianCalendar) {
+   o = new Timestamp(((GregorianCalendar) 
o).getTimeInMillis());
}
try {
 return LiteralExpression.newConstant(o, targetType);



Build failed in Jenkins: Phoenix | Master #1409

2016-09-20 Thread Apache Jenkins Server
See 

Changes:

[maryannxue] PHOENIX-3279 QueryPlan.iterator(ParallelScanGrouper scanGrouper) 
should

--
[...truncated 744 lines...]
Running org.apache.phoenix.tx.TransactionIT
Tests run: 36, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 286.29 sec - 
in org.apache.phoenix.end2end.index.LocalIndexIT
Running org.apache.phoenix.tx.TxCheckpointIT
Tests run: 28, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 655.666 sec - 
in org.apache.phoenix.end2end.InListIT

Results :

Tests in error: 
  AlterTableIT.testNewColumnFamilyInheritsTTLOfEmptyCF:1429 » SQLTimeout 
Operati...

Tests run: 1025, Failures: 0, Errors: 1, Skipped: 4

[INFO] 
[INFO] --- maven-failsafe-plugin:2.19.1:integration-test 
(ClientManagedTimeTests) @ phoenix-core ---

---
 T E S T S
---
Running org.apache.phoenix.end2end.CastAndCoerceIT
Running org.apache.phoenix.end2end.ColumnProjectionOptimizationIT
Running org.apache.phoenix.end2end.AggregateQueryIT
Running org.apache.phoenix.end2end.ClientTimeArithmeticQueryIT
Running org.apache.phoenix.end2end.CreateSchemaIT
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.341 sec - in 
org.apache.phoenix.end2end.CreateSchemaIT
Running org.apache.phoenix.end2end.CreateTableIT
Running org.apache.phoenix.end2end.CaseStatementIT
Running org.apache.phoenix.end2end.ArrayIT
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 27.897 sec - in 
org.apache.phoenix.end2end.ColumnProjectionOptimizationIT
Running org.apache.phoenix.end2end.CustomEntityDataIT
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 8.749 sec - in 
org.apache.phoenix.end2end.CustomEntityDataIT
Running org.apache.phoenix.end2end.DerivedTableIT
Tests run: 49, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 65.566 sec - 
in org.apache.phoenix.end2end.CastAndCoerceIT
Running org.apache.phoenix.end2end.DistinctCountIT
Tests run: 18, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 31.502 sec - 
in org.apache.phoenix.end2end.DerivedTableIT
Running org.apache.phoenix.end2end.DropSchemaIT
Tests run: 63, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 71.925 sec - 
in org.apache.phoenix.end2end.CaseStatementIT
Running org.apache.phoenix.end2end.ExtendedQueryExecIT
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 11.886 sec - in 
org.apache.phoenix.end2end.DropSchemaIT
Running org.apache.phoenix.end2end.FunkyNamesIT
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 7.518 sec - in 
org.apache.phoenix.end2end.ExtendedQueryExecIT
Running org.apache.phoenix.end2end.GroupByIT
Tests run: 10, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 20.453 sec - 
in org.apache.phoenix.end2end.DistinctCountIT
Tests run: 49, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 85.772 sec - 
in org.apache.phoenix.end2end.AggregateQueryIT
Running org.apache.phoenix.end2end.NotQueryIT
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 5.806 sec - in 
org.apache.phoenix.end2end.FunkyNamesIT
Running org.apache.phoenix.end2end.PointInTimeQueryIT
Running org.apache.phoenix.end2end.NativeHBaseTypesIT
Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 5.604 sec - in 
org.apache.phoenix.end2end.NativeHBaseTypesIT
Running org.apache.phoenix.end2end.ProductMetricsIT
Tests run: 15, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 102.363 sec - 
in org.apache.phoenix.end2end.CreateTableIT
Running org.apache.phoenix.end2end.QueryDatabaseMetaDataIT
Tests run: 79, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 108.572 sec - 
in org.apache.phoenix.end2end.ArrayIT
Running org.apache.phoenix.end2end.QueryIT
Tests run: 14, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 31.451 sec - 
in org.apache.phoenix.end2end.PointInTimeQueryIT
Running org.apache.phoenix.end2end.ReadIsolationLevelIT
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 6.891 sec - in 
org.apache.phoenix.end2end.ReadIsolationLevelIT
Running org.apache.phoenix.end2end.RowValueConstructorIT
Tests run: 61, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 43.817 sec - 
in org.apache.phoenix.end2end.ProductMetricsIT
Running org.apache.phoenix.end2end.ScanQueryIT
Tests run: 77, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 66.9 sec - in 
org.apache.phoenix.end2end.NotQueryIT
Running org.apache.phoenix.end2end.SequenceBulkAllocationIT
Tests run: 105, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 104.921 sec - 
in org.apache.phoenix.end2end.GroupByIT
Running org.apache.phoenix.end2end.SequenceIT
Tests run: 56, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 60.584 sec - 
in org.apache.phoenix.end2end.SequenceBulkAllocationIT
Running org.apache.phoenix.end2end.ToNumberFunctionIT
Tests run: 18, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 13.067 sec - 
in org.apache.phoenix.end2end.ToNumberFunc

phoenix git commit: PHOENIX-3279 QueryPlan.iterator(ParallelScanGrouper scanGrouper) should pass null ('unknown') as scan parameter when calling this.iterator(ParallelScanGrouper scanGrouper, Scan sca

2016-09-20 Thread maryannxue
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.1 bda4acaeb -> fe2c33441


PHOENIX-3279 QueryPlan.iterator(ParallelScanGrouper scanGrouper) should pass 
null ('unknown') as scan parameter when calling 
this.iterator(ParallelScanGrouper scanGrouper, Scan scan)


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

Branch: refs/heads/4.x-HBase-1.1
Commit: fe2c334418287aa7b45a3aead0583b75d72299da
Parents: bda4aca
Author: maryannxue 
Authored: Tue Sep 20 09:34:18 2016 -0700
Committer: maryannxue 
Committed: Tue Sep 20 09:34:18 2016 -0700

--
 .../apache/phoenix/end2end/DerivedTableIT.java  | 11 ++
 .../apache/phoenix/execute/BaseQueryPlan.java   | 16 +--
 .../phoenix/execute/ClientAggregatePlan.java|  7 +--
 .../phoenix/execute/ClientProcessingPlan.java   |  9 -
 .../apache/phoenix/execute/ClientScanPlan.java  |  4 
 .../apache/phoenix/execute/CorrelatePlan.java   | 15 ++
 .../phoenix/execute/DelegateQueryPlan.java  | 13 
 .../apache/phoenix/execute/HashJoinPlan.java| 15 --
 .../phoenix/execute/TupleProjectionPlan.java| 11 --
 .../org/apache/phoenix/execute/UnionPlan.java   | 21 
 .../apache/phoenix/execute/UnnestArrayPlan.java | 11 --
 .../phoenix/iterate/UnionResultIterators.java   |  4 +---
 12 files changed, 50 insertions(+), 87 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/fe2c3344/phoenix-core/src/it/java/org/apache/phoenix/end2end/DerivedTableIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DerivedTableIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DerivedTableIT.java
index 862416b..67be132 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DerivedTableIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DerivedTableIT.java
@@ -225,6 +225,17 @@ public class DerivedTableIT extends 
BaseClientManagedTimeIT {
 assertEquals(ROW2,rs.getString(1));
 
 assertFalse(rs.next());
+
+// ((where limit) where limit) limit
+query = "SELECT u.eid FROM (SELECT t.eid FROM (SELECT entity_id 
eid, b_string b FROM aTable WHERE a_string = '" + B_VALUE + "' LIMIT 5) AS t 
WHERE t.b = '" + C_VALUE + "' LIMIT 4) AS u WHERE u.eid >= '" + ROW1 + "' LIMIT 
3";
+statement = conn.prepareStatement(query);
+rs = statement.executeQuery();
+assertTrue (rs.next());
+assertEquals(ROW5,rs.getString(1));
+assertTrue (rs.next());
+assertEquals(ROW8,rs.getString(1));
+
+assertFalse(rs.next());
 
 // (count) where
 query = "SELECT t.c FROM (SELECT count(*) c FROM aTable) AS t 
WHERE t.c > 0";

http://git-wip-us.apache.org/repos/asf/phoenix/blob/fe2c3344/phoenix-core/src/main/java/org/apache/phoenix/execute/BaseQueryPlan.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/execute/BaseQueryPlan.java 
b/phoenix-core/src/main/java/org/apache/phoenix/execute/BaseQueryPlan.java
index 1e09079..76dec2f 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/execute/BaseQueryPlan.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/execute/BaseQueryPlan.java
@@ -200,10 +200,15 @@ public abstract class BaseQueryPlan implements QueryPlan {
 //byte[] producer = Bytes.toBytes(UUID.randomUUID().toString());
 //scan.setAttribute(HBaseServer.CALL_QUEUE_PRODUCER_ATTRIB_NAME, 
producer);
 //}
+
+@Override
+public final ResultIterator iterator() throws SQLException {
+return iterator(Collections.emptyList(), 
DefaultParallelScanGrouper.getInstance(), null);
+}
 
 @Override
 public final ResultIterator iterator(ParallelScanGrouper scanGrouper) 
throws SQLException {
-return iterator(Collections.emptyList(), scanGrouper, 
this.context.getScan());
+return iterator(Collections.emptyList(), scanGrouper, 
null);
 }
 
 @Override
@@ -211,12 +216,11 @@ public abstract class BaseQueryPlan implements QueryPlan {
 return iterator(Collections.emptyList(), scanGrouper, 
scan);
 }
 
-@Override
-public final ResultIterator iterator() throws SQLException {
-return iterator(Collections.emptyList(), 
DefaultParallelScanGrouper.getInstance(), this.context.getScan());
-}
-
 public final ResultIterator iterator(final List 
dependencies, ParallelScanGrouper scanGrouper, Scan scan) 

phoenix git commit: PHOENIX-3279 QueryPlan.iterator(ParallelScanGrouper scanGrouper) should pass null ('unknown') as scan parameter when calling this.iterator(ParallelScanGrouper scanGrouper, Scan sca

2016-09-20 Thread maryannxue
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-0.98 d6230307a -> 858734ff7


PHOENIX-3279 QueryPlan.iterator(ParallelScanGrouper scanGrouper) should pass 
null ('unknown') as scan parameter when calling 
this.iterator(ParallelScanGrouper scanGrouper, Scan scan)


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

Branch: refs/heads/4.x-HBase-0.98
Commit: 858734ff7ffdfe5d050c62212c6d9f6543c8f27a
Parents: d623030
Author: maryannxue 
Authored: Tue Sep 20 09:24:09 2016 -0700
Committer: maryannxue 
Committed: Tue Sep 20 09:24:09 2016 -0700

--
 .../apache/phoenix/end2end/DerivedTableIT.java  | 11 ++
 .../apache/phoenix/execute/BaseQueryPlan.java   | 16 +--
 .../phoenix/execute/ClientAggregatePlan.java|  7 +--
 .../phoenix/execute/ClientProcessingPlan.java   |  9 -
 .../apache/phoenix/execute/ClientScanPlan.java  |  4 
 .../apache/phoenix/execute/CorrelatePlan.java   | 15 ++
 .../phoenix/execute/DelegateQueryPlan.java  | 13 
 .../apache/phoenix/execute/HashJoinPlan.java| 15 --
 .../phoenix/execute/TupleProjectionPlan.java| 11 --
 .../org/apache/phoenix/execute/UnionPlan.java   | 21 
 .../apache/phoenix/execute/UnnestArrayPlan.java | 11 --
 .../phoenix/iterate/UnionResultIterators.java   |  4 +---
 12 files changed, 50 insertions(+), 87 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/858734ff/phoenix-core/src/it/java/org/apache/phoenix/end2end/DerivedTableIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DerivedTableIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DerivedTableIT.java
index 1d6dd24..be6b48e 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DerivedTableIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DerivedTableIT.java
@@ -224,6 +224,17 @@ public class DerivedTableIT extends 
BaseClientManagedTimeIT {
 assertEquals(ROW2,rs.getString(1));
 
 assertFalse(rs.next());
+
+// ((where limit) where limit) limit
+query = "SELECT u.eid FROM (SELECT t.eid FROM (SELECT entity_id 
eid, b_string b FROM aTable WHERE a_string = '" + B_VALUE + "' LIMIT 5) AS t 
WHERE t.b = '" + C_VALUE + "' LIMIT 4) AS u WHERE u.eid >= '" + ROW1 + "' LIMIT 
3";
+statement = conn.prepareStatement(query);
+rs = statement.executeQuery();
+assertTrue (rs.next());
+assertEquals(ROW5,rs.getString(1));
+assertTrue (rs.next());
+assertEquals(ROW8,rs.getString(1));
+
+assertFalse(rs.next());
 
 // (count) where
 query = "SELECT t.c FROM (SELECT count(*) c FROM aTable) AS t 
WHERE t.c > 0";

http://git-wip-us.apache.org/repos/asf/phoenix/blob/858734ff/phoenix-core/src/main/java/org/apache/phoenix/execute/BaseQueryPlan.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/execute/BaseQueryPlan.java 
b/phoenix-core/src/main/java/org/apache/phoenix/execute/BaseQueryPlan.java
index 74ac269..352b533 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/execute/BaseQueryPlan.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/execute/BaseQueryPlan.java
@@ -200,10 +200,15 @@ public abstract class BaseQueryPlan implements QueryPlan {
 //byte[] producer = Bytes.toBytes(UUID.randomUUID().toString());
 //scan.setAttribute(HBaseServer.CALL_QUEUE_PRODUCER_ATTRIB_NAME, 
producer);
 //}
+
+@Override
+public final ResultIterator iterator() throws SQLException {
+return iterator(Collections.emptyList(), 
DefaultParallelScanGrouper.getInstance(), null);
+}
 
 @Override
 public final ResultIterator iterator(ParallelScanGrouper scanGrouper) 
throws SQLException {
-return iterator(Collections.emptyList(), scanGrouper, 
this.context.getScan());
+return iterator(Collections.emptyList(), scanGrouper, 
null);
 }
 
 @Override
@@ -211,12 +216,11 @@ public abstract class BaseQueryPlan implements QueryPlan {
 return iterator(Collections.emptyList(), scanGrouper, 
scan);
 }
 
-@Override
-public final ResultIterator iterator() throws SQLException {
-return iterator(Collections.emptyList(), 
DefaultParallelScanGrouper.getInstance(), this.context.getScan());
-}
-
 public final ResultIterator iterator(final List 
dependencies, ParallelScanGrouper scanGrouper, Scan scan

phoenix git commit: PHOENIX-3279 QueryPlan.iterator(ParallelScanGrouper scanGrouper) should pass null ('unknown') as scan parameter when calling this.iterator(ParallelScanGrouper scanGrouper, Scan sca

2016-09-20 Thread maryannxue
Repository: phoenix
Updated Branches:
  refs/heads/master 0a05d67f1 -> 7601d5942


PHOENIX-3279 QueryPlan.iterator(ParallelScanGrouper scanGrouper) should pass 
null ('unknown') as scan parameter when calling 
this.iterator(ParallelScanGrouper scanGrouper, Scan scan)


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

Branch: refs/heads/master
Commit: 7601d5942fdeb55c114295292e2100aafb84e861
Parents: 0a05d67
Author: maryannxue 
Authored: Tue Sep 20 09:19:06 2016 -0700
Committer: maryannxue 
Committed: Tue Sep 20 09:19:06 2016 -0700

--
 .../apache/phoenix/end2end/DerivedTableIT.java  | 11 ++
 .../apache/phoenix/execute/BaseQueryPlan.java   | 16 +--
 .../phoenix/execute/ClientAggregatePlan.java|  7 +--
 .../phoenix/execute/ClientProcessingPlan.java   |  9 -
 .../apache/phoenix/execute/ClientScanPlan.java  |  4 
 .../apache/phoenix/execute/CorrelatePlan.java   | 15 ++
 .../phoenix/execute/DelegateQueryPlan.java  | 13 
 .../apache/phoenix/execute/HashJoinPlan.java| 15 --
 .../phoenix/execute/TupleProjectionPlan.java| 11 --
 .../org/apache/phoenix/execute/UnionPlan.java   | 21 
 .../apache/phoenix/execute/UnnestArrayPlan.java | 11 --
 .../phoenix/iterate/UnionResultIterators.java   |  4 +---
 12 files changed, 50 insertions(+), 87 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/7601d594/phoenix-core/src/it/java/org/apache/phoenix/end2end/DerivedTableIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DerivedTableIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DerivedTableIT.java
index 862416b..67be132 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DerivedTableIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DerivedTableIT.java
@@ -225,6 +225,17 @@ public class DerivedTableIT extends 
BaseClientManagedTimeIT {
 assertEquals(ROW2,rs.getString(1));
 
 assertFalse(rs.next());
+
+// ((where limit) where limit) limit
+query = "SELECT u.eid FROM (SELECT t.eid FROM (SELECT entity_id 
eid, b_string b FROM aTable WHERE a_string = '" + B_VALUE + "' LIMIT 5) AS t 
WHERE t.b = '" + C_VALUE + "' LIMIT 4) AS u WHERE u.eid >= '" + ROW1 + "' LIMIT 
3";
+statement = conn.prepareStatement(query);
+rs = statement.executeQuery();
+assertTrue (rs.next());
+assertEquals(ROW5,rs.getString(1));
+assertTrue (rs.next());
+assertEquals(ROW8,rs.getString(1));
+
+assertFalse(rs.next());
 
 // (count) where
 query = "SELECT t.c FROM (SELECT count(*) c FROM aTable) AS t 
WHERE t.c > 0";

http://git-wip-us.apache.org/repos/asf/phoenix/blob/7601d594/phoenix-core/src/main/java/org/apache/phoenix/execute/BaseQueryPlan.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/execute/BaseQueryPlan.java 
b/phoenix-core/src/main/java/org/apache/phoenix/execute/BaseQueryPlan.java
index 1e09079..76dec2f 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/execute/BaseQueryPlan.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/execute/BaseQueryPlan.java
@@ -200,10 +200,15 @@ public abstract class BaseQueryPlan implements QueryPlan {
 //byte[] producer = Bytes.toBytes(UUID.randomUUID().toString());
 //scan.setAttribute(HBaseServer.CALL_QUEUE_PRODUCER_ATTRIB_NAME, 
producer);
 //}
+
+@Override
+public final ResultIterator iterator() throws SQLException {
+return iterator(Collections.emptyList(), 
DefaultParallelScanGrouper.getInstance(), null);
+}
 
 @Override
 public final ResultIterator iterator(ParallelScanGrouper scanGrouper) 
throws SQLException {
-return iterator(Collections.emptyList(), scanGrouper, 
this.context.getScan());
+return iterator(Collections.emptyList(), scanGrouper, 
null);
 }
 
 @Override
@@ -211,12 +216,11 @@ public abstract class BaseQueryPlan implements QueryPlan {
 return iterator(Collections.emptyList(), scanGrouper, 
scan);
 }
 
-@Override
-public final ResultIterator iterator() throws SQLException {
-return iterator(Collections.emptyList(), 
DefaultParallelScanGrouper.getInstance(), this.context.getScan());
-}
-
 public final ResultIterator iterator(final List 
dependencies, ParallelScanGrouper scanGrouper, Scan scan) throws SQLExce

Build failed in Jenkins: Phoenix Compile Level Compatibility with HBase #57

2016-09-20 Thread Apache Jenkins Server
See 

--
Started by timer
[EnvInject] - Loading node environment variables.
Building remotely on ubuntu-5 (Ubuntu yahoo-not-h2 ubuntu ubuntu5 docker) in 
workspace 
[Phoenix_Compile_Compat_wHBase] $ /bin/bash /tmp/hudson1388243693071370375.sh
core file size  (blocks, -c) 0
data seg size   (kbytes, -d) unlimited
scheduling priority (-e) 0
file size   (blocks, -f) unlimited
pending signals (-i) 386178
max locked memory   (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files  (-n) 6
pipe size(512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority  (-r) 0
stack size  (kbytes, -s) 8192
cpu time   (seconds, -t) unlimited
max user processes  (-u) 10240
virtual memory  (kbytes, -v) unlimited
file locks  (-x) unlimited
core id : 0
core id : 1
core id : 10
core id : 9
physical id : 0
physical id : 1
MemTotal:   49453340 kB
MemFree:11255012 kB
Filesystem  Size  Used Avail Use% Mounted on
udev 24G   12K   24G   1% /dev
tmpfs   4.8G  824K  4.8G   1% /run
/dev/dm-0   3.6T  691G  2.7T  21% /
none4.0K 0  4.0K   0% /sys/fs/cgroup
none5.0M 0  5.0M   0% /run/lock
none 24G 0   24G   0% /run/shm
none100M 0  100M   0% /run/user
/dev/sda2   237M  143M   82M  64% /boot
3.0.4
apache-maven-2.2.1
apache-maven-3.0.4
apache-maven-3.0.4.bak
apache-maven-3.0.5
apache-maven-3.2.1
apache-maven-3.2.5
apache-maven-3.3.3
apache-maven-3.3.9
latest
latest2
latest3


===
Verifying compile level compatibility with HBase 0.98 with Phoenix 
4.x-HBase-0.98
===

Cloning into 'hbase'...
Switched to a new branch '0.98'
Branch 0.98 set up to track remote branch 0.98 from origin.

main:
 [exec] 
~/jenkins-slave/workspace/Phoenix_Compile_Compat_wHBase/hbase/hbase-common 
~/jenkins-slave/workspace/Phoenix_Compile_Compat_wHBase/hbase/hbase-common
 [exec] 
~/jenkins-slave/workspace/Phoenix_Compile_Compat_wHBase/hbase/hbase-common

main:
[mkdir] Created dir: 

 [exec] tar: hadoop-snappy-nativelibs.tar: Cannot open: No such file or 
directory
 [exec] tar: Error is not recoverable: exiting now
 [exec] Result: 2

main:
[mkdir] Created dir: 

 [copy] Copying 20 files to 

[mkdir] Created dir: 

[mkdir] Created dir: 


main:
[mkdir] Created dir: 

 [copy] Copying 17 files to 

[mkdir] Created dir: 


main:
[mkdir] Created dir: 

 [copy] Copying 1 file to 

[mkdir] Created dir: 


HBase pom.xml:

Got HBase version as 0.98.23-SNAPSHOT
Cloning into 'phoenix'...
Switched to a new branch '4.x-HBase-0.98'
Branch 4.x-HBase-0.98 set up to track remote branch 4.x-HBase-0.98 from origin.
ANTLR Parser Generator  Version 3.5.2
Output file 

 does not exist: must build 

PhoenixSQL.g


===
Verifying compile level compatibility with HBase branch-1.2 with Phoenix master
==

Build failed in Jenkins: Phoenix-4.x-HBase-1.1 #204

2016-09-20 Thread Apache Jenkins Server
See 

Changes:

[samarth] PHOENIX-3302 Use unique names for views and indexes in

--
[...truncated 1135 lines...]
at 
org.apache.phoenix.end2end.ViewIT.testViewAddsNotNullPKColumn(ViewIT.java:632)
Caused by: org.apache.thrift.TException: Unable to discover tx service.
at 
org.apache.phoenix.end2end.ViewIT.testViewAddsNotNullPKColumn(ViewIT.java:632)

testReadOnlyViewWithCaseSensitiveTableNames[transactional = 
true](org.apache.phoenix.end2end.ViewIT)  Time elapsed: 46.22 sec  <<< ERROR!
java.lang.RuntimeException: java.lang.Exception: Thrift error for 
org.apache.tephra.distributed.TransactionServiceClient$2@37158a3f: Unable to 
discover tx service.
at 
org.apache.phoenix.end2end.ViewIT.testReadOnlyViewWithCaseSensitiveTableNames(ViewIT.java:250)
Caused by: java.lang.Exception: Thrift error for 
org.apache.tephra.distributed.TransactionServiceClient$2@37158a3f: Unable to 
discover tx service.
at 
org.apache.phoenix.end2end.ViewIT.testReadOnlyViewWithCaseSensitiveTableNames(ViewIT.java:250)
Caused by: org.apache.thrift.TException: Unable to discover tx service.
at 
org.apache.phoenix.end2end.ViewIT.testReadOnlyViewWithCaseSensitiveTableNames(ViewIT.java:250)

testViewAndTableAndDropCascadeWithIndexes[transactional = 
true](org.apache.phoenix.end2end.ViewIT)  Time elapsed: 46.25 sec  <<< ERROR!
java.lang.RuntimeException: java.lang.Exception: Thrift error for 
org.apache.tephra.distributed.TransactionServiceClient$2@35ccf1f3: Unable to 
discover tx service.
at 
org.apache.phoenix.end2end.ViewIT.testViewAndTableAndDropCascadeWithIndexes(ViewIT.java:437)
Caused by: java.lang.Exception: Thrift error for 
org.apache.tephra.distributed.TransactionServiceClient$2@35ccf1f3: Unable to 
discover tx service.
at 
org.apache.phoenix.end2end.ViewIT.testViewAndTableAndDropCascadeWithIndexes(ViewIT.java:437)
Caused by: org.apache.thrift.TException: Unable to discover tx service.
at 
org.apache.phoenix.end2end.ViewIT.testViewAndTableAndDropCascadeWithIndexes(ViewIT.java:437)

testViewUsesTableLocalIndex[transactional = 
true](org.apache.phoenix.end2end.ViewIT)  Time elapsed: 46.166 sec  <<< ERROR!
java.lang.RuntimeException: java.lang.Exception: Thrift error for 
org.apache.tephra.distributed.TransactionServiceClient$2@4179c9e: Unable to 
discover tx service.
at 
org.apache.phoenix.end2end.ViewIT.testViewUsesTableIndex(ViewIT.java:500)
at 
org.apache.phoenix.end2end.ViewIT.testViewUsesTableLocalIndex(ViewIT.java:489)
Caused by: java.lang.Exception: Thrift error for 
org.apache.tephra.distributed.TransactionServiceClient$2@4179c9e: Unable to 
discover tx service.
at 
org.apache.phoenix.end2end.ViewIT.testViewUsesTableIndex(ViewIT.java:500)
at 
org.apache.phoenix.end2end.ViewIT.testViewUsesTableLocalIndex(ViewIT.java:489)
Caused by: org.apache.thrift.TException: Unable to discover tx service.
at 
org.apache.phoenix.end2end.ViewIT.testViewUsesTableIndex(ViewIT.java:500)
at 
org.apache.phoenix.end2end.ViewIT.testViewUsesTableLocalIndex(ViewIT.java:489)

testDisallowDropOfColumnOnParentTable[transactional = 
true](org.apache.phoenix.end2end.ViewIT)  Time elapsed: 46.262 sec  <<< ERROR!
java.lang.RuntimeException: java.lang.Exception: Thrift error for 
org.apache.tephra.distributed.TransactionServiceClient$2@594aab65: Unable to 
discover tx service.
at 
org.apache.phoenix.end2end.ViewIT.testDisallowDropOfColumnOnParentTable(ViewIT.java:392)
Caused by: java.lang.Exception: Thrift error for 
org.apache.tephra.distributed.TransactionServiceClient$2@594aab65: Unable to 
discover tx service.
at 
org.apache.phoenix.end2end.ViewIT.testDisallowDropOfColumnOnParentTable(ViewIT.java:392)
Caused by: org.apache.thrift.TException: Unable to discover tx service.
at 
org.apache.phoenix.end2end.ViewIT.testDisallowDropOfColumnOnParentTable(ViewIT.java:392)

testViewUsesTableGlobalIndex[transactional = 
true](org.apache.phoenix.end2end.ViewIT)  Time elapsed: 46.253 sec  <<< ERROR!
java.lang.RuntimeException: java.lang.Exception: Thrift error for 
org.apache.tephra.distributed.TransactionServiceClient$2@25e997a3: Unable to 
discover tx service.
at 
org.apache.phoenix.end2end.ViewIT.testViewUsesTableIndex(ViewIT.java:500)
at 
org.apache.phoenix.end2end.ViewIT.testViewUsesTableGlobalIndex(ViewIT.java:484)
Caused by: java.lang.Exception: Thrift error for 
org.apache.tephra.distributed.TransactionServiceClient$2@25e997a3: Unable to 
discover tx service.
at 
org.apache.phoenix.end2end.ViewIT.testViewUsesTableIndex(ViewIT.java:500)
at 
org.apache.phoenix.end2end.ViewIT.testViewUsesTableGlobalIndex(ViewIT.java:484)
Caused by: org.apache.thrift.TException: Unable to discover tx service.
at 
org.apache.phoenix.end2end.ViewIT.testViewUsesTableIndex(ViewIT.java:500)
at 
org.a

Build failed in Jenkins: Phoenix | 4.x-HBase-0.98 #1318

2016-09-20 Thread Apache Jenkins Server
See 

Changes:

[samarth] PHOENIX-3302 Use unique names for views and indexes in

--
[...truncated 294 lines...]
Running org.apache.phoenix.expression.CoerceExpressionTest
Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.006 sec - in 
org.apache.phoenix.expression.CoerceExpressionTest
Running org.apache.phoenix.expression.DeterminismTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 sec - in 
org.apache.phoenix.expression.DeterminismTest
Running org.apache.phoenix.expression.RegexpSplitFunctionTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.011 sec - in 
org.apache.phoenix.expression.RegexpSplitFunctionTest
Running org.apache.phoenix.util.DateUtilTest
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.573 sec - in 
org.apache.phoenix.expression.GetSetByteBitFunctionTest
Running org.apache.phoenix.util.ColumnInfoTest
Tests run: 22, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.025 sec - in 
org.apache.phoenix.util.DateUtilTest
Running org.apache.phoenix.util.ByteUtilTest
Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.008 sec - in 
org.apache.phoenix.util.ColumnInfoTest
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.035 sec - in 
org.apache.phoenix.util.ByteUtilTest
Running org.apache.phoenix.util.csv.StringToArrayConverterTest
Running org.apache.phoenix.util.csv.CsvUpsertExecutorTest
Tests run: 35, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.53 sec - in 
org.apache.phoenix.expression.ArrayConcatFunctionTest
Running org.apache.phoenix.util.StringUtilTest
Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.004 sec - in 
org.apache.phoenix.util.StringUtilTest
Running org.apache.phoenix.util.IndexUtilTest
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.005 sec - in 
org.apache.phoenix.util.IndexUtilTest
Running org.apache.phoenix.util.LogUtilTest
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.329 sec - in 
org.apache.phoenix.util.csv.StringToArrayConverterTest
Running org.apache.phoenix.util.TenantIdByteConversionTest
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.241 sec - in 
org.apache.phoenix.util.LogUtilTest
Tests run: 18, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.032 sec - in 
org.apache.phoenix.util.TenantIdByteConversionTest
Running org.apache.phoenix.util.LikeExpressionTest
Running org.apache.phoenix.util.ScanUtilTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 sec - in 
org.apache.phoenix.util.LikeExpressionTest
Running org.apache.phoenix.util.JDBCUtilTest
Tests run: 10, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.006 sec - in 
org.apache.phoenix.util.JDBCUtilTest
Running org.apache.phoenix.util.MetaDataUtilTest
Tests run: 20, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.099 sec - in 
org.apache.phoenix.util.ScanUtilTest
Running org.apache.phoenix.util.json.JsonUpsertExecutorTest
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.043 sec - in 
org.apache.phoenix.util.MetaDataUtilTest
Tests run: 6, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.631 sec - in 
org.apache.phoenix.util.csv.CsvUpsertExecutorTest
Running org.apache.phoenix.util.PropertiesUtilTest
Running org.apache.phoenix.util.SequenceUtilTest
Tests run: 18, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.011 sec - in 
org.apache.phoenix.util.SequenceUtilTest
Running org.apache.phoenix.util.QueryUtilTest
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.025 sec - in 
org.apache.phoenix.util.PropertiesUtilTest
Tests run: 9, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.01 sec - in 
org.apache.phoenix.util.QueryUtilTest
Running org.apache.phoenix.util.PhoenixEncodeDecodeTest
Running org.apache.phoenix.util.PhoenixRuntimeTest
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.335 sec - in 
org.apache.phoenix.util.PhoenixEncodeDecodeTest
Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.365 sec - in 
org.apache.phoenix.util.json.JsonUpsertExecutorTest
Running org.apache.phoenix.util.PhoenixContextExecutorTest
Running org.apache.phoenix.util.PrefixByteEncoderDecoderTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.002 sec - in 
org.apache.phoenix.util.PhoenixContextExecutorTest
Running org.apache.phoenix.util.Base62EncoderTest
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.005 sec - in 
org.apache.phoenix.util.PrefixByteEncoderDecoderTest
Running org.apache.phoenix.cache.TenantCacheTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.016 sec - in 
org.apache.phoenix.util.Base62EncoderTest
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.013 sec - in 
org.apache.phoenix.cache.TenantCacheTest
Running org.apache.phoenix.cache.JodaTimezoneCacheTest

Jenkins build is back to normal : Phoenix-4.8-HBase-1.2 #28

2016-09-20 Thread Apache Jenkins Server
See 



Apache-Phoenix | 4.8-HBase-1.0 | Build Successful

2016-09-20 Thread Apache Jenkins Server
4.8-HBase-1.0 branch build status Successful

Source repository https://git-wip-us.apache.org/repos/asf?p=phoenix.git;a=shortlog;h=refs/heads/4.8-HBase-1.0

Compiled Artifacts https://builds.apache.org/job/Phoenix-4.8-HBase-1.0/lastSuccessfulBuild/artifact/

Test Report https://builds.apache.org/job/Phoenix-4.8-HBase-1.0/lastCompletedBuild/testReport/

Changes
[larsh] Add missing license header to ChildViewsUseParentViewIndexIT



Build times for last couple of runsLatest build time is the right most | Legend blue: normal, red: test failure, gray: timeout