[29/50] [abbrv] phoenix git commit: PHOENIX-3660 Don't pass statement properties while adding columns to a table that already exists that had APPEND_ONLY_SCHEMA=true

2017-02-14 Thread samarth
PHOENIX-3660 Don't pass statement properties while adding columns to a table 
that already exists that had APPEND_ONLY_SCHEMA=true


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

Branch: refs/heads/encodecolumns2
Commit: 234e427b31b8b00a95e7d7dd1e5f143dce20dd16
Parents: f11237c
Author: Thomas D'Silva 
Authored: Mon Feb 13 13:35:59 2017 -0800
Committer: Thomas D'Silva 
Committed: Mon Feb 13 14:34:55 2017 -0800

--
 .../phoenix/end2end/AppendOnlySchemaIT.java | 28 +++-
 .../apache/phoenix/schema/MetaDataClient.java   |  3 ++-
 2 files changed, 23 insertions(+), 8 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/234e427b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AppendOnlySchemaIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AppendOnlySchemaIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AppendOnlySchemaIT.java
index 7ed64ff..e9a20b3 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AppendOnlySchemaIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AppendOnlySchemaIT.java
@@ -81,23 +81,37 @@ public class AppendOnlySchemaIT extends 
ParallelStatsDisabledIT {
 // create sequence for auto partition
 conn1.createStatement().execute("CREATE SEQUENCE " + 
metricIdSeqTableName + " CACHE 1");
 // create base table
-conn1.createStatement().execute("CREATE TABLE "+ metricTableName + 
"(metricId INTEGER NOT NULL, metricVal DOUBLE, CONSTRAINT PK PRIMARY 
KEY(metricId))"
-+ " APPEND_ONLY_SCHEMA = true, UPDATE_CACHE_FREQUENCY=1, 
AUTO_PARTITION_SEQ=" + metricIdSeqTableName);
+String ddl = "CREATE TABLE " + (notExists ? "IF NOT EXISTS " : "") 
+ metricTableName + "(metricId INTEGER NOT NULL, metricVal DOUBLE, CONSTRAINT 
PK PRIMARY KEY(metricId))"
++ " APPEND_ONLY_SCHEMA = true, UPDATE_CACHE_FREQUENCY=1, 
AUTO_PARTITION_SEQ=" + metricIdSeqTableName;
+   conn1.createStatement().execute(ddl);
+   // execute same create ddl
+try {
+conn2.createStatement().execute(ddl);
+if (!notExists) {
+fail("Create Table should fail");
+}
+}
+catch (TableAlreadyExistsException e) {
+if (notExists) {
+fail("Create Table should not fail");
+}
+}
+   
 // create view
-String ddl =
+String viewDDL =
 "CREATE VIEW " + (notExists ? "IF NOT EXISTS " : "")
 + viewName + " ( hostName varchar NOT NULL, 
tagName varChar"
 + " CONSTRAINT HOSTNAME_PK PRIMARY KEY (hostName))"
 + " AS SELECT * FROM " + metricTableName
 + " UPDATE_CACHE_FREQUENCY=30";
-conn1.createStatement().execute(ddl);
+conn1.createStatement().execute(viewDDL);
 conn1.createStatement().execute("UPSERT INTO " + viewName + 
"(hostName, metricVal) VALUES('host1', 1.0)");
 conn1.commit();
 reset(connectionQueryServices);
 
 // execute same create ddl
 try {
-conn2.createStatement().execute(ddl);
+conn2.createStatement().execute(viewDDL);
 if (!notExists) {
 fail("Create Table should fail");
 }
@@ -118,9 +132,9 @@ public class AppendOnlySchemaIT extends 
ParallelStatsDisabledIT {
 reset(connectionQueryServices);
 
 // execute alter table ddl that adds the same column
-ddl = "ALTER VIEW " + viewName + " ADD " + (notExists ? "IF NOT 
EXISTS" : "") + " tagName varchar";
+viewDDL = "ALTER VIEW " + viewName + " ADD " + (notExists ? "IF 
NOT EXISTS" : "") + " tagName varchar";
 try {
-conn2.createStatement().execute(ddl);
+conn2.createStatement().execute(viewDDL);
 if (!notExists) {
 fail("Alter Table should fail");
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/234e427b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
--
diff --git 

phoenix git commit: PHOENIX-3660 Don't pass statement properties while adding columns to a table that already exists that had APPEND_ONLY_SCHEMA=true

2017-02-13 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-0.98 f11237c8e -> 234e427b3


PHOENIX-3660 Don't pass statement properties while adding columns to a table 
that already exists that had APPEND_ONLY_SCHEMA=true


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

Branch: refs/heads/4.x-HBase-0.98
Commit: 234e427b31b8b00a95e7d7dd1e5f143dce20dd16
Parents: f11237c
Author: Thomas D'Silva 
Authored: Mon Feb 13 13:35:59 2017 -0800
Committer: Thomas D'Silva 
Committed: Mon Feb 13 14:34:55 2017 -0800

--
 .../phoenix/end2end/AppendOnlySchemaIT.java | 28 +++-
 .../apache/phoenix/schema/MetaDataClient.java   |  3 ++-
 2 files changed, 23 insertions(+), 8 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/234e427b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AppendOnlySchemaIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AppendOnlySchemaIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AppendOnlySchemaIT.java
index 7ed64ff..e9a20b3 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AppendOnlySchemaIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AppendOnlySchemaIT.java
@@ -81,23 +81,37 @@ public class AppendOnlySchemaIT extends 
ParallelStatsDisabledIT {
 // create sequence for auto partition
 conn1.createStatement().execute("CREATE SEQUENCE " + 
metricIdSeqTableName + " CACHE 1");
 // create base table
-conn1.createStatement().execute("CREATE TABLE "+ metricTableName + 
"(metricId INTEGER NOT NULL, metricVal DOUBLE, CONSTRAINT PK PRIMARY 
KEY(metricId))"
-+ " APPEND_ONLY_SCHEMA = true, UPDATE_CACHE_FREQUENCY=1, 
AUTO_PARTITION_SEQ=" + metricIdSeqTableName);
+String ddl = "CREATE TABLE " + (notExists ? "IF NOT EXISTS " : "") 
+ metricTableName + "(metricId INTEGER NOT NULL, metricVal DOUBLE, CONSTRAINT 
PK PRIMARY KEY(metricId))"
++ " APPEND_ONLY_SCHEMA = true, UPDATE_CACHE_FREQUENCY=1, 
AUTO_PARTITION_SEQ=" + metricIdSeqTableName;
+   conn1.createStatement().execute(ddl);
+   // execute same create ddl
+try {
+conn2.createStatement().execute(ddl);
+if (!notExists) {
+fail("Create Table should fail");
+}
+}
+catch (TableAlreadyExistsException e) {
+if (notExists) {
+fail("Create Table should not fail");
+}
+}
+   
 // create view
-String ddl =
+String viewDDL =
 "CREATE VIEW " + (notExists ? "IF NOT EXISTS " : "")
 + viewName + " ( hostName varchar NOT NULL, 
tagName varChar"
 + " CONSTRAINT HOSTNAME_PK PRIMARY KEY (hostName))"
 + " AS SELECT * FROM " + metricTableName
 + " UPDATE_CACHE_FREQUENCY=30";
-conn1.createStatement().execute(ddl);
+conn1.createStatement().execute(viewDDL);
 conn1.createStatement().execute("UPSERT INTO " + viewName + 
"(hostName, metricVal) VALUES('host1', 1.0)");
 conn1.commit();
 reset(connectionQueryServices);
 
 // execute same create ddl
 try {
-conn2.createStatement().execute(ddl);
+conn2.createStatement().execute(viewDDL);
 if (!notExists) {
 fail("Create Table should fail");
 }
@@ -118,9 +132,9 @@ public class AppendOnlySchemaIT extends 
ParallelStatsDisabledIT {
 reset(connectionQueryServices);
 
 // execute alter table ddl that adds the same column
-ddl = "ALTER VIEW " + viewName + " ADD " + (notExists ? "IF NOT 
EXISTS" : "") + " tagName varchar";
+viewDDL = "ALTER VIEW " + viewName + " ADD " + (notExists ? "IF 
NOT EXISTS" : "") + " tagName varchar";
 try {
-conn2.createStatement().execute(ddl);
+conn2.createStatement().execute(viewDDL);
 if (!notExists) {
 fail("Alter Table should fail");
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/234e427b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java