phoenix git commit: PHOENIX-1078 Unable to run pig script with Phoenix in a secure HBase cluster

2015-02-25 Thread jeffreyz
Repository: phoenix
Updated Branches:
  refs/heads/4.0 18b0d6904 - b9d1722c6


PHOENIX-1078 Unable to run pig script with Phoenix in a secure HBase cluster


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

Branch: refs/heads/4.0
Commit: b9d1722c6085e534846a5b10205ef1b85dc7297c
Parents: 18b0d69
Author: Jeffrey Zhong jeffr...@apache.org
Authored: Thu Feb 12 19:22:17 2015 -0800
Committer: Jeffrey Zhong jeffr...@apache.org
Committed: Wed Feb 25 14:58:00 2015 -0800

--
 .../phoenix/mapreduce/util/ConnectionUtil.java |  9 +
 .../mapreduce/util/PhoenixConfigurationUtil.java   | 17 +
 .../org/apache/phoenix/pig/PhoenixHBaseLoader.java |  9 ++---
 .../apache/phoenix/pig/PhoenixHBaseStorage.java|  2 ++
 4 files changed, 34 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/b9d1722c/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/util/ConnectionUtil.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/util/ConnectionUtil.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/util/ConnectionUtil.java
index 0864cba..364baf7 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/util/ConnectionUtil.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/util/ConnectionUtil.java
@@ -20,6 +20,8 @@ package org.apache.phoenix.mapreduce.util;
 import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.SQLException;
+import java.util.Iterator;
+import java.util.Map;
 import java.util.Properties;
 
 import org.apache.hadoop.conf.Configuration;
@@ -42,6 +44,13 @@ public class ConnectionUtil {
 public static Connection getConnection(final Configuration configuration) 
throws SQLException {
 Preconditions.checkNotNull(configuration);
 final Properties props = new Properties();
+IteratorMap.EntryString, String iterator = 
configuration.iterator();
+if(iterator != null) {
+while (iterator.hasNext()) {
+Map.EntryString, String entry = iterator.next();
+props.setProperty(entry.getKey(), entry.getValue());
+}
+}
 final Connection conn = 
DriverManager.getConnection(QueryUtil.getUrl(configuration.get(HConstants.ZOOKEEPER_QUORUM)),
 props);
 return conn;
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/b9d1722c/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/util/PhoenixConfigurationUtil.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/util/PhoenixConfigurationUtil.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/util/PhoenixConfigurationUtil.java
index 83a606b..4d025ee 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/util/PhoenixConfigurationUtil.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/util/PhoenixConfigurationUtil.java
@@ -19,13 +19,18 @@ package org.apache.phoenix.mapreduce.util;
 
 import static org.apache.commons.lang.StringUtils.isNotEmpty;
 
+import java.io.IOException;
 import java.sql.Connection;
 import java.sql.SQLException;
 import java.util.List;
+import java.util.Map;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.HBaseConfiguration;
+import org.apache.hadoop.hbase.mapreduce.TableMapReduceUtil;
+import org.apache.hadoop.mapreduce.Job;
 import org.apache.hadoop.mapreduce.lib.db.DBInputFormat.NullDBWritable;
 import org.apache.hadoop.mapreduce.lib.db.DBWritable;
 import org.apache.phoenix.jdbc.PhoenixConnection;
@@ -296,4 +301,16 @@ public final class PhoenixConfigurationUtil {
 Preconditions.checkNotNull(configuration);
 return configuration.get(OUTPUT_TABLE_NAME);
 }
+
+public static void loadHBaseConfiguration(Job job) throws IOException {
+// load hbase-site.xml
+Configuration hbaseConf = HBaseConfiguration.create();
+for (Map.EntryString, String entry : hbaseConf) {
+if (job.getConfiguration().get(entry.getKey()) == null) {
+job.getConfiguration().set(entry.getKey(), entry.getValue());
+}
+}
+//In order to have phoenix working on a secured cluster
+TableMapReduceUtil.initCredentials(job);
+}
 }


phoenix git commit: PHOENIX-1142 Improve CsvBulkLoadTool to parse different Date formats

2015-02-06 Thread jeffreyz
Repository: phoenix
Updated Branches:
  refs/heads/master 8c340f5a6 - 2d7703339


PHOENIX-1142 Improve CsvBulkLoadTool to parse different Date formats


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

Branch: refs/heads/master
Commit: 2d7703339f87c73625d251fe3322f839cc1ee791
Parents: 8c340f5
Author: Jeffrey Zhong jeffr...@apache.org
Authored: Mon Feb 2 22:33:04 2015 -0800
Committer: Jeffrey Zhong jeffr...@apache.org
Committed: Fri Feb 6 14:08:15 2015 -0800

--
 .../phoenix/end2end/ProductMetricsIT.java   |   7 +-
 .../phoenix/end2end/ToDateFunctionIT.java   |  15 ++
 .../phoenix/end2end/TruncateFunctionIT.java |   5 +-
 .../apache/phoenix/end2end/UpsertValuesIT.java  |  63 ++--
 .../phoenix/end2end/VariableLengthPKIT.java |   7 +-
 .../phoenix/mapreduce/CsvBulkLoadToolIT.java|  21 ++-
 .../phoenix/expression/LiteralExpression.java   |   9 +-
 .../expression/function/ToDateFunction.java |  17 +--
 .../apache/phoenix/parse/ToDateParseNode.java   |  10 +-
 .../org/apache/phoenix/schema/types/PDate.java  |   5 +-
 .../org/apache/phoenix/schema/types/PTime.java  |   2 +
 .../apache/phoenix/schema/types/PTimestamp.java |   2 +
 .../java/org/apache/phoenix/util/DateUtil.java  | 147 +--
 .../phoenix/util/csv/CsvUpsertExecutor.java |  35 -
 .../util/csv/StringToArrayConverter.java|  24 +--
 .../phoenix/compile/WhereCompilerTest.java  |   3 +-
 .../org/apache/phoenix/util/DateUtilTest.java   |  28 ++--
 17 files changed, 265 insertions(+), 135 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/2d770333/phoenix-core/src/it/java/org/apache/phoenix/end2end/ProductMetricsIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ProductMetricsIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ProductMetricsIT.java
index cd436e5..975541e 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ProductMetricsIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ProductMetricsIT.java
@@ -57,7 +57,6 @@ import com.google.common.collect.Ordering;
 
 
 public class ProductMetricsIT extends BaseClientManagedTimeIT {
-private static Format format = 
DateUtil.getDateParser(DateUtil.DEFAULT_DATE_FORMAT);
 private static final String PRODUCT_METRICS_NAME = PRODUCT_METRICS;
 private static final String PRODUCT_METRICS_SCHEMA_NAME = ;
 private static final String DS1 = 1970-01-01 00:58:00;
@@ -88,11 +87,7 @@ public class ProductMetricsIT extends 
BaseClientManagedTimeIT {
 }
 
 private static Date toDate(String dateString) {
-try {
-return (Date)format.parseObject(dateString);
-} catch (ParseException e) {
-throw new RuntimeException(e);
-}
+return DateUtil.parseDateTime(dateString);
 }
 
 private static void initTable(byte[][] splits, long ts) throws Exception {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/2d770333/phoenix-core/src/it/java/org/apache/phoenix/end2end/ToDateFunctionIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ToDateFunctionIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ToDateFunctionIT.java
index 19257c1..984e21b 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ToDateFunctionIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ToDateFunctionIT.java
@@ -27,12 +27,14 @@ import java.sql.Statement;
 import java.util.Properties;
 
 import org.apache.phoenix.query.QueryServices;
+import org.apache.phoenix.util.DateUtil;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 
 public class ToDateFunctionIT extends BaseHBaseManagedTimeIT {
@@ -69,6 +71,19 @@ public class ToDateFunctionIT extends BaseHBaseManagedTimeIT 
{
 public void testToDate_Default() throws SQLException {
 // Default time zone is GMT, so this is timestamp 0
 assertEquals(0L, callToDateFunction(TO_DATE('1970-01-01 
00:00:00')).getTime());
+assertEquals(0L, callToDateFunction(TO_DATE('1970-01-01 
00:00:00.000')).getTime());
+assertEquals(0L, 
callToDateFunction(TO_DATE('1970-01-01')).getTime());
+assertEquals(0L, 
callToDateFunction(TO_DATE('1970/01/01','/MM/dd')).getTime());
+
+// Test other ISO 8601 Date Compliant Formats to verify they can be 
parsed
+

phoenix git commit: PHOENIX-1142 Improve CsvBulkLoadTool to parse different Date formats

2015-02-06 Thread jeffreyz
Repository: phoenix
Updated Branches:
  refs/heads/4.0 5acebb38b - 760ffbe19


PHOENIX-1142 Improve CsvBulkLoadTool to parse different Date formats


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

Branch: refs/heads/4.0
Commit: 760ffbe19aadbe44a7d6fb6901cc594a63095639
Parents: 5acebb3
Author: Jeffrey Zhong jeffr...@apache.org
Authored: Mon Feb 2 22:33:04 2015 -0800
Committer: Jeffrey Zhong jeffr...@apache.org
Committed: Fri Feb 6 14:14:29 2015 -0800

--
 .../phoenix/end2end/ProductMetricsIT.java   |   7 +-
 .../phoenix/end2end/ToDateFunctionIT.java   |  15 ++
 .../phoenix/end2end/TruncateFunctionIT.java |   5 +-
 .../apache/phoenix/end2end/UpsertValuesIT.java  |  63 ++--
 .../phoenix/end2end/VariableLengthPKIT.java |   7 +-
 .../phoenix/mapreduce/CsvBulkLoadToolIT.java|  21 ++-
 .../phoenix/expression/LiteralExpression.java   |   9 +-
 .../expression/function/ToDateFunction.java |  17 +--
 .../apache/phoenix/parse/ToDateParseNode.java   |  10 +-
 .../org/apache/phoenix/schema/types/PDate.java  |   5 +-
 .../org/apache/phoenix/schema/types/PTime.java  |   2 +
 .../apache/phoenix/schema/types/PTimestamp.java |   2 +
 .../java/org/apache/phoenix/util/DateUtil.java  | 147 +--
 .../phoenix/util/csv/CsvUpsertExecutor.java |  35 -
 .../util/csv/StringToArrayConverter.java|  24 +--
 .../phoenix/compile/WhereCompilerTest.java  |   3 +-
 .../org/apache/phoenix/util/DateUtilTest.java   |  28 ++--
 17 files changed, 265 insertions(+), 135 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/760ffbe1/phoenix-core/src/it/java/org/apache/phoenix/end2end/ProductMetricsIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ProductMetricsIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ProductMetricsIT.java
index cd436e5..975541e 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ProductMetricsIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ProductMetricsIT.java
@@ -57,7 +57,6 @@ import com.google.common.collect.Ordering;
 
 
 public class ProductMetricsIT extends BaseClientManagedTimeIT {
-private static Format format = 
DateUtil.getDateParser(DateUtil.DEFAULT_DATE_FORMAT);
 private static final String PRODUCT_METRICS_NAME = PRODUCT_METRICS;
 private static final String PRODUCT_METRICS_SCHEMA_NAME = ;
 private static final String DS1 = 1970-01-01 00:58:00;
@@ -88,11 +87,7 @@ public class ProductMetricsIT extends 
BaseClientManagedTimeIT {
 }
 
 private static Date toDate(String dateString) {
-try {
-return (Date)format.parseObject(dateString);
-} catch (ParseException e) {
-throw new RuntimeException(e);
-}
+return DateUtil.parseDateTime(dateString);
 }
 
 private static void initTable(byte[][] splits, long ts) throws Exception {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/760ffbe1/phoenix-core/src/it/java/org/apache/phoenix/end2end/ToDateFunctionIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ToDateFunctionIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ToDateFunctionIT.java
index 19257c1..984e21b 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ToDateFunctionIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ToDateFunctionIT.java
@@ -27,12 +27,14 @@ import java.sql.Statement;
 import java.util.Properties;
 
 import org.apache.phoenix.query.QueryServices;
+import org.apache.phoenix.util.DateUtil;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 
 public class ToDateFunctionIT extends BaseHBaseManagedTimeIT {
@@ -69,6 +71,19 @@ public class ToDateFunctionIT extends BaseHBaseManagedTimeIT 
{
 public void testToDate_Default() throws SQLException {
 // Default time zone is GMT, so this is timestamp 0
 assertEquals(0L, callToDateFunction(TO_DATE('1970-01-01 
00:00:00')).getTime());
+assertEquals(0L, callToDateFunction(TO_DATE('1970-01-01 
00:00:00.000')).getTime());
+assertEquals(0L, 
callToDateFunction(TO_DATE('1970-01-01')).getTime());
+assertEquals(0L, 
callToDateFunction(TO_DATE('1970/01/01','/MM/dd')).getTime());
+
+// Test other ISO 8601 Date Compliant Formats to verify they can be 
parsed
+try {

phoenix git commit: PHOENIX-1592 ORDER BY not closing ResultIterator properly

2015-01-16 Thread jeffreyz
Repository: phoenix
Updated Branches:
  refs/heads/4.0 7cf8799d9 - 0c6f11ef3


PHOENIX-1592 ORDER BY not closing ResultIterator properly


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

Branch: refs/heads/4.0
Commit: 0c6f11ef3403c3d3d1283776a97c09c9a87debbc
Parents: 7cf8799
Author: Jeffrey Zhong jeffr...@apache.org
Authored: Fri Jan 16 10:27:10 2015 -0800
Committer: Jeffrey Zhong jeffr...@apache.org
Committed: Fri Jan 16 15:20:16 2015 -0800

--
 .../apache/phoenix/coprocessor/ScanRegionObserver.java  | 12 +++-
 .../apache/phoenix/iterate/OrderedResultIterator.java   |  4 +++-
 2 files changed, 14 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/0c6f11ef/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/ScanRegionObserver.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/ScanRegionObserver.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/ScanRegionObserver.java
index f0ae4a2..9270495 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/ScanRegionObserver.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/ScanRegionObserver.java
@@ -22,6 +22,7 @@ import java.io.ByteArrayOutputStream;
 import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
+import java.sql.SQLException;
 import java.util.List;
 import java.util.Set;
 
@@ -281,7 +282,16 @@ public class ScanRegionObserver extends 
BaseScannerRegionObserver {
 try {
 s.close();
 } finally {
-chunk.close();}
+try {
+if(iterator != null) {
+iterator.close();
+}
+} catch (SQLException e) {
+
ServerUtil.throwIOException(region.getRegionNameAsString(), e);
+} finally {
+chunk.close();
+}
+}
 }
 
 @Override

http://git-wip-us.apache.org/repos/asf/phoenix/blob/0c6f11ef/phoenix-core/src/main/java/org/apache/phoenix/iterate/OrderedResultIterator.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/iterate/OrderedResultIterator.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/OrderedResultIterator.java
index d087f80..7b7d4dc 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/iterate/OrderedResultIterator.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/OrderedResultIterator.java
@@ -185,6 +185,7 @@ public class OrderedResultIterator implements 
PeekingResultIterator {
 public Tuple next() throws SQLException {
 ResultEntry entry = queueEntries.poll();
 if (entry == null || (limit != null  ++count  limit)) {
+resultIterator.close();
 resultIterator = PeekingResultIterator.EMPTY_ITERATOR;
 return null;
 }
@@ -239,7 +240,8 @@ public class OrderedResultIterator implements 
PeekingResultIterator {
 }
 
 @Override
-public void close()  {
+public void close() throws SQLException {
+resultIterator.close();
 resultIterator = PeekingResultIterator.EMPTY_ITERATOR;
 }
 



phoenix git commit: PHOENIX-1592 ORDER BY not closing ResultIterator properly

2015-01-16 Thread jeffreyz
Repository: phoenix
Updated Branches:
  refs/heads/master b2b5788d9 - 4e8e30b40


PHOENIX-1592 ORDER BY not closing ResultIterator properly


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

Branch: refs/heads/master
Commit: 4e8e30b40f6394f1a3fceffe565ed1ee1d642005
Parents: b2b5788
Author: Jeffrey Zhong jeffr...@apache.org
Authored: Fri Jan 16 10:27:10 2015 -0800
Committer: Jeffrey Zhong jeffr...@apache.org
Committed: Fri Jan 16 15:21:04 2015 -0800

--
 .../apache/phoenix/coprocessor/ScanRegionObserver.java  | 12 +++-
 .../apache/phoenix/iterate/OrderedResultIterator.java   |  4 +++-
 2 files changed, 14 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/4e8e30b4/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/ScanRegionObserver.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/ScanRegionObserver.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/ScanRegionObserver.java
index f0ae4a2..9270495 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/ScanRegionObserver.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/ScanRegionObserver.java
@@ -22,6 +22,7 @@ import java.io.ByteArrayOutputStream;
 import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
+import java.sql.SQLException;
 import java.util.List;
 import java.util.Set;
 
@@ -281,7 +282,16 @@ public class ScanRegionObserver extends 
BaseScannerRegionObserver {
 try {
 s.close();
 } finally {
-chunk.close();}
+try {
+if(iterator != null) {
+iterator.close();
+}
+} catch (SQLException e) {
+
ServerUtil.throwIOException(region.getRegionNameAsString(), e);
+} finally {
+chunk.close();
+}
+}
 }
 
 @Override

http://git-wip-us.apache.org/repos/asf/phoenix/blob/4e8e30b4/phoenix-core/src/main/java/org/apache/phoenix/iterate/OrderedResultIterator.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/iterate/OrderedResultIterator.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/OrderedResultIterator.java
index d087f80..7b7d4dc 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/iterate/OrderedResultIterator.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/OrderedResultIterator.java
@@ -185,6 +185,7 @@ public class OrderedResultIterator implements 
PeekingResultIterator {
 public Tuple next() throws SQLException {
 ResultEntry entry = queueEntries.poll();
 if (entry == null || (limit != null  ++count  limit)) {
+resultIterator.close();
 resultIterator = PeekingResultIterator.EMPTY_ITERATOR;
 return null;
 }
@@ -239,7 +240,8 @@ public class OrderedResultIterator implements 
PeekingResultIterator {
 }
 
 @Override
-public void close()  {
+public void close() throws SQLException {
+resultIterator.close();
 resultIterator = PeekingResultIterator.EMPTY_ITERATOR;
 }
 



phoenix git commit: PHOENIX-1551 Upgrading from Phoenix 4.0.x to 4.2.2 and throw can't find SYSTEM.STATS

2015-01-12 Thread jeffreyz
Repository: phoenix
Updated Branches:
  refs/heads/4.0 b871f0693 - 16fbfa7ab


PHOENIX-1551 Upgrading from Phoenix 4.0.x to 4.2.2 and throw can't find 
SYSTEM.STATS


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

Branch: refs/heads/4.0
Commit: 16fbfa7abd1c8f7e265b8656e8f574ae7f6f93b9
Parents: b871f06
Author: Jeffrey Zhong jeffr...@apache.org
Authored: Mon Jan 12 14:12:52 2015 -0800
Committer: Jeffrey Zhong jeffr...@apache.org
Committed: Mon Jan 12 14:12:52 2015 -0800

--
 .../main/java/org/apache/phoenix/util/ServerUtil.java  | 13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/16fbfa7a/phoenix-core/src/main/java/org/apache/phoenix/util/ServerUtil.java
--
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/ServerUtil.java 
b/phoenix-core/src/main/java/org/apache/phoenix/util/ServerUtil.java
index 7205faa..0998e72 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/ServerUtil.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/ServerUtil.java
@@ -142,13 +142,22 @@ public class ServerUtil {
  * This code works around HBASE-11837 which causes HTableInterfaces 
retrieved from
  * RegionCoprocessorEnvironment to not read local data.
  */
-private static HTableInterface 
getTableFromSingletonPool(RegionCoprocessorEnvironment env, byte[] tableName) {
+private static HTableInterface 
getTableFromSingletonPool(RegionCoprocessorEnvironment env, byte[] tableName) 
throws IOException {
 // It's ok to not ever do a pool.close() as we're storing a single
 // table only. The HTablePool holds no other resources that this table
 // which will be closed itself when it's no longer needed.
 @SuppressWarnings(resource)
 HTablePool pool = new HTablePool(env.getConfiguration(),1);
-return pool.getTable(tableName);
+try {
+return pool.getTable(tableName);
+} catch (RuntimeException t) {
+// handle cases that an IOE is wrapped inside a RuntimeException 
like HTableInterface#createHTableInterface
+if(t.getCause() instanceof IOException) {
+throw (IOException)t.getCause();
+} else {
+throw t;
+}
+}
 }
 
 public static HTableInterface getHTableForCoprocessorScan 
(RegionCoprocessorEnvironment env, HTableInterface writerTable) throws 
IOException {



phoenix git commit: PHOENIX-1551 Upgrading from Phoenix 4.0.x to 4.2.2 and throw can't find SYSTEM.STATS

2015-01-12 Thread jeffreyz
Repository: phoenix
Updated Branches:
  refs/heads/master 71832b59f - ddcb591f3


PHOENIX-1551 Upgrading from Phoenix 4.0.x to 4.2.2 and throw can't find 
SYSTEM.STATS


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

Branch: refs/heads/master
Commit: ddcb591f3ed3aa8e9d4ab1f7eda62052638647bc
Parents: 71832b5
Author: Jeffrey Zhong jeffr...@apache.org
Authored: Mon Jan 12 14:12:52 2015 -0800
Committer: Jeffrey Zhong jeffr...@apache.org
Committed: Mon Jan 12 15:12:16 2015 -0800

--
 .../main/java/org/apache/phoenix/util/ServerUtil.java  | 13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/ddcb591f/phoenix-core/src/main/java/org/apache/phoenix/util/ServerUtil.java
--
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/ServerUtil.java 
b/phoenix-core/src/main/java/org/apache/phoenix/util/ServerUtil.java
index 7205faa..0998e72 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/ServerUtil.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/ServerUtil.java
@@ -142,13 +142,22 @@ public class ServerUtil {
  * This code works around HBASE-11837 which causes HTableInterfaces 
retrieved from
  * RegionCoprocessorEnvironment to not read local data.
  */
-private static HTableInterface 
getTableFromSingletonPool(RegionCoprocessorEnvironment env, byte[] tableName) {
+private static HTableInterface 
getTableFromSingletonPool(RegionCoprocessorEnvironment env, byte[] tableName) 
throws IOException {
 // It's ok to not ever do a pool.close() as we're storing a single
 // table only. The HTablePool holds no other resources that this table
 // which will be closed itself when it's no longer needed.
 @SuppressWarnings(resource)
 HTablePool pool = new HTablePool(env.getConfiguration(),1);
-return pool.getTable(tableName);
+try {
+return pool.getTable(tableName);
+} catch (RuntimeException t) {
+// handle cases that an IOE is wrapped inside a RuntimeException 
like HTableInterface#createHTableInterface
+if(t.getCause() instanceof IOException) {
+throw (IOException)t.getCause();
+} else {
+throw t;
+}
+}
 }
 
 public static HTableInterface getHTableForCoprocessorScan 
(RegionCoprocessorEnvironment env, HTableInterface writerTable) throws 
IOException {



phoenix git commit: PHOENIX-1498: Turn KEEP_DELETED_CELLS off by default

2014-12-10 Thread jeffreyz
Repository: phoenix
Updated Branches:
  refs/heads/master f84e5da33 - 5722a4d31


PHOENIX-1498: Turn KEEP_DELETED_CELLS off by default


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

Branch: refs/heads/master
Commit: 5722a4d31318cb04473fed8bf72c5202b33d1e0d
Parents: f84e5da
Author: Jeffrey Zhong jeffr...@apache.org
Authored: Mon Dec 8 18:30:08 2014 -0800
Committer: Jeffrey Zhong jeffr...@apache.org
Committed: Wed Dec 10 14:22:02 2014 -0800

--
 .../java/org/apache/phoenix/end2end/BaseQueryIT.java |  7 +++
 .../java/org/apache/phoenix/end2end/GroupByIT.java   | 15 +++
 .../phoenix/end2end/QueryDatabaseMetaDataIT.java | 12 
 .../it/java/org/apache/phoenix/end2end/QueryIT.java  | 13 +
 .../apache/phoenix/coprocessor/MetaDataProtocol.java |  2 ++
 .../phoenix/query/ConnectionQueryServicesImpl.java   |  5 -
 .../org/apache/phoenix/query/QueryConstants.java |  9 ++---
 .../java/org/apache/phoenix/query/QueryServices.java |  1 +
 .../apache/phoenix/query/QueryServicesOptions.java   |  1 +
 9 files changed, 61 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/5722a4d3/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseQueryIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseQueryIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseQueryIT.java
index e404c17..fc088ac 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseQueryIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseQueryIT.java
@@ -67,7 +67,14 @@ public abstract class BaseQueryIT extends 
BaseClientManagedTimeIT {
 @BeforeClass
 @Shadower(classBeingShadowed = BaseClientManagedTimeIT.class)
 public static void doSetup() throws Exception {
+doSetup(null);
+}
+
+protected static void doSetup(MapString,String customProps) throws 
Exception {
 MapString,String props = getDefaultProps();
+if(customProps != null) {
+   props.putAll(customProps);
+}
 props.put(QueryServices.QUEUE_SIZE_ATTRIB, Integer.toString(5000));
 props.put(IndexWriterUtils.HTABLE_THREAD_KEY, Integer.toString(100));
 // Make a small batch size to test multiple calls to reserve sequences

http://git-wip-us.apache.org/repos/asf/phoenix/blob/5722a4d3/phoenix-core/src/it/java/org/apache/phoenix/end2end/GroupByIT.java
--
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/GroupByIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/GroupByIT.java
index 55bce01..31a55a0 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/GroupByIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/GroupByIT.java
@@ -33,6 +33,7 @@ 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;
@@ -40,16 +41,22 @@ 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 org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.util.PhoenixRuntime;
 import org.apache.phoenix.util.PropertiesUtil;
+import org.apache.phoenix.util.ReadOnlyProps;
+import org.junit.Before;
+import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
 import org.junit.runners.Parameterized.Parameters;
 
 import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
 
 
 @RunWith(Parameterized.class)
@@ -64,6 +71,14 @@ public class GroupByIT extends BaseQueryIT {
 return QueryIT.data();
 }
 
+@BeforeClass
+@Shadower(classBeingShadowed = BaseQueryIT.class)
+public static void doSetup() throws Exception {
+   MapString,String props = Maps.newHashMapWithExpectedSize(3);
+   props.put(QueryServices.DEFAULT_KEEP_DELETED_CELLS_ATTRIB, true);
+   BaseQueryIT.doSetup(props);
+}
+
 @SuppressWarnings(unchecked)
 @Test
 public void testGroupByCondition() throws Exception {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/5722a4d3/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java
--
diff --git 

phoenix git commit: PHOENIX-1498: Turn KEEP_DELETED_CELLS off by default

2014-12-10 Thread jeffreyz
Repository: phoenix
Updated Branches:
  refs/heads/4.0 b70f3abd2 - f01a8d808


PHOENIX-1498: Turn KEEP_DELETED_CELLS off by default


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

Branch: refs/heads/4.0
Commit: f01a8d8088e12be6be10cfb2c483a53cec96e3e8
Parents: b70f3ab
Author: Jeffrey Zhong jeffr...@apache.org
Authored: Mon Dec 8 18:30:08 2014 -0800
Committer: Jeffrey Zhong jeffr...@apache.org
Committed: Wed Dec 10 14:25:39 2014 -0800

--
 .../java/org/apache/phoenix/end2end/BaseQueryIT.java |  7 +++
 .../java/org/apache/phoenix/end2end/GroupByIT.java   | 15 +++
 .../phoenix/end2end/QueryDatabaseMetaDataIT.java | 12 
 .../it/java/org/apache/phoenix/end2end/QueryIT.java  | 13 +
 .../apache/phoenix/coprocessor/MetaDataProtocol.java |  2 ++
 .../phoenix/query/ConnectionQueryServicesImpl.java   |  5 -
 .../org/apache/phoenix/query/QueryConstants.java |  9 ++---
 .../java/org/apache/phoenix/query/QueryServices.java |  1 +
 .../apache/phoenix/query/QueryServicesOptions.java   |  1 +
 9 files changed, 61 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/f01a8d80/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseQueryIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseQueryIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseQueryIT.java
index e404c17..fc088ac 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseQueryIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseQueryIT.java
@@ -67,7 +67,14 @@ public abstract class BaseQueryIT extends 
BaseClientManagedTimeIT {
 @BeforeClass
 @Shadower(classBeingShadowed = BaseClientManagedTimeIT.class)
 public static void doSetup() throws Exception {
+doSetup(null);
+}
+
+protected static void doSetup(MapString,String customProps) throws 
Exception {
 MapString,String props = getDefaultProps();
+if(customProps != null) {
+   props.putAll(customProps);
+}
 props.put(QueryServices.QUEUE_SIZE_ATTRIB, Integer.toString(5000));
 props.put(IndexWriterUtils.HTABLE_THREAD_KEY, Integer.toString(100));
 // Make a small batch size to test multiple calls to reserve sequences

http://git-wip-us.apache.org/repos/asf/phoenix/blob/f01a8d80/phoenix-core/src/it/java/org/apache/phoenix/end2end/GroupByIT.java
--
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/GroupByIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/GroupByIT.java
index 55bce01..31a55a0 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/GroupByIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/GroupByIT.java
@@ -33,6 +33,7 @@ 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;
@@ -40,16 +41,22 @@ 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 org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.util.PhoenixRuntime;
 import org.apache.phoenix.util.PropertiesUtil;
+import org.apache.phoenix.util.ReadOnlyProps;
+import org.junit.Before;
+import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
 import org.junit.runners.Parameterized.Parameters;
 
 import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
 
 
 @RunWith(Parameterized.class)
@@ -64,6 +71,14 @@ public class GroupByIT extends BaseQueryIT {
 return QueryIT.data();
 }
 
+@BeforeClass
+@Shadower(classBeingShadowed = BaseQueryIT.class)
+public static void doSetup() throws Exception {
+   MapString,String props = Maps.newHashMapWithExpectedSize(3);
+   props.put(QueryServices.DEFAULT_KEEP_DELETED_CELLS_ATTRIB, true);
+   BaseQueryIT.doSetup(props);
+}
+
 @SuppressWarnings(unchecked)
 @Test
 public void testGroupByCondition() throws Exception {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/f01a8d80/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java
--
diff --git 

phoenix git commit: PHOENIX-1477: Phoenix 4.0 - 4.2 upgrade doesn't work

2014-12-02 Thread jeffreyz
Repository: phoenix
Updated Branches:
  refs/heads/4.0 f57eac18e - 429acbab7


PHOENIX-1477: Phoenix 4.0 - 4.2 upgrade doesn't work


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

Branch: refs/heads/4.0
Commit: 429acbab7d2e2aabb99a6b50d1bc113462009acc
Parents: f57eac1
Author: Jeffrey Zhong jeffr...@apache.org
Authored: Tue Dec 2 13:42:26 2014 -0800
Committer: Jeffrey Zhong jeffr...@apache.org
Committed: Tue Dec 2 13:42:26 2014 -0800

--
 .../org/apache/phoenix/query/ConnectionQueryServicesImpl.java | 7 +++
 1 file changed, 7 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/429acbab/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 299b367..d443c53 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
@@ -1678,6 +1678,13 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 // Ignore, as this will happen if the 
SYSTEM.CATALOG already exists at this fixed timestamp.
 // A TableAlreadyExistsException is not 
thrown, since the table only exists *after* this fixed timestamp.
 } catch (TableAlreadyExistsException ignore) {
+// This will occur if we have an older 
SYSTEM.CATALOG and we need to update it to include
+// any new columns we've added.
+metaConnection = 
addColumnsIfNotExists(metaConnection,
+  PhoenixDatabaseMetaData.SYSTEM_CATALOG,
+  MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP,
+  PhoenixDatabaseMetaData.INDEX_TYPE +   + 
PDataType.UNSIGNED_TINYINT.getSqlTypeName() +
+  ,  + 
PhoenixDatabaseMetaData.INDEX_DISABLE_TIMESTAMP +   + 
PDataType.LONG.getSqlTypeName());
 }
 int nSaltBuckets = 
ConnectionQueryServicesImpl.this.props.getInt(QueryServices.SEQUENCE_SALT_BUCKETS_ATTRIB,
 
QueryServicesOptions.DEFAULT_SEQUENCE_TABLE_SALT_BUCKETS);



phoenix git commit: PHOENIX-1477: Phoenix 4.0 - 4.2 upgrade doesn't work

2014-12-02 Thread jeffreyz
Repository: phoenix
Updated Branches:
  refs/heads/4.2 bdb724d34 - 5580da441


PHOENIX-1477: Phoenix 4.0 - 4.2 upgrade doesn't work


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

Branch: refs/heads/4.2
Commit: 5580da441f3b8cb568df694ced104c247698c618
Parents: bdb724d
Author: Jeffrey Zhong jeffr...@apache.org
Authored: Tue Dec 2 13:42:26 2014 -0800
Committer: Jeffrey Zhong jeffr...@apache.org
Committed: Tue Dec 2 13:46:42 2014 -0800

--
 .../org/apache/phoenix/query/ConnectionQueryServicesImpl.java | 7 +++
 1 file changed, 7 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/5580da44/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 8bd99b3..63fa07a 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
@@ -1553,6 +1553,13 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 // Ignore, as this will happen if the 
SYSTEM.CATALOG already exists at this fixed timestamp.
 // A TableAlreadyExistsException is not 
thrown, since the table only exists *after* this fixed timestamp.
 } catch (TableAlreadyExistsException ignore) {
+// This will occur if we have an older 
SYSTEM.CATALOG and we need to update it to include
+// any new columns we've added.
+metaConnection = 
addColumnsIfNotExists(metaConnection,
+  PhoenixDatabaseMetaData.SYSTEM_CATALOG,
+  MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP,
+  PhoenixDatabaseMetaData.INDEX_TYPE +   + 
PDataType.UNSIGNED_TINYINT.getSqlTypeName() +
+  ,  + 
PhoenixDatabaseMetaData.INDEX_DISABLE_TIMESTAMP +   + 
PDataType.LONG.getSqlTypeName());
 }
 int nSaltBuckets = 
ConnectionQueryServicesImpl.this.props.getInt(QueryServices.SEQUENCE_SALT_BUCKETS_ATTRIB,
 
QueryServicesOptions.DEFAULT_SEQUENCE_TABLE_SALT_BUCKETS);



phoenix git commit: PHOENIX-1395: ResultSpooler spill files are left behind in /tmp folder (Alicia Ying Shu)

2014-11-20 Thread jeffreyz
Repository: phoenix
Updated Branches:
  refs/heads/master 2d5acb4e9 - 46aa58216


PHOENIX-1395: ResultSpooler spill files are left behind in /tmp folder (Alicia 
Ying Shu)


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

Branch: refs/heads/master
Commit: 46aa582165825d215ba7f94ee28b1b957885c11d
Parents: 2d5acb4
Author: Jeffrey Zhong jeffr...@apache.org
Authored: Thu Nov 20 15:39:05 2014 -0800
Committer: Jeffrey Zhong jeffr...@apache.org
Committed: Thu Nov 20 15:39:05 2014 -0800

--
 .../phoenix/iterate/SpoolingResultIterator.java |   3 +
 .../iterate/SpooledTmpFileDeleteTest.java   | 127 +++
 2 files changed, 130 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/46aa5821/phoenix-core/src/main/java/org/apache/phoenix/iterate/SpoolingResultIterator.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/iterate/SpoolingResultIterator.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/SpoolingResultIterator.java
index 87ed241..71ad7d7 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/iterate/SpoolingResultIterator.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/SpoolingResultIterator.java
@@ -116,6 +116,9 @@ public class SpoolingResultIterator implements 
PeekingResultIterator {
 spoolFrom = new InMemoryResultIterator(data, chunk);
 } else {
 spoolFrom = new OnDiskResultIterator(spoolTo.getFile());
+if (spoolTo.getFile() != null) {
+spoolTo.getFile().deleteOnExit();
+}
 }
 success = true;
 } catch (IOException e) {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/46aa5821/phoenix-core/src/test/java/org/apache/phoenix/iterate/SpooledTmpFileDeleteTest.java
--
diff --git 
a/phoenix-core/src/test/java/org/apache/phoenix/iterate/SpooledTmpFileDeleteTest.java
 
b/phoenix-core/src/test/java/org/apache/phoenix/iterate/SpooledTmpFileDeleteTest.java
new file mode 100644
index 000..4a205f9
--- /dev/null
+++ 
b/phoenix-core/src/test/java/org/apache/phoenix/iterate/SpooledTmpFileDeleteTest.java
@@ -0,0 +1,127 @@
+/*
+ * 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.iterate;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
+
+import java.io.File;
+import java.io.FileFilter;
+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.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import org.apache.phoenix.end2end.BaseClientManagedTimeIT;
+import org.apache.phoenix.end2end.ClientManagedTimeTest;
+import org.apache.phoenix.query.QueryServices;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+
+@Category(ClientManagedTimeTest.class)
+public class SpooledTmpFileDeleteTest extends BaseClientManagedTimeIT {
+   private Connection conn = null;
+   private Properties props = null;
+
+   @Before 
+   public void setup() throws SQLException {
+   props = new Properties();
+   props.put(QueryServices.SPOOL_DIRECTORY, /tmp); 
+   props.setProperty(QueryServices.SPOOL_THRESHOLD_BYTES_ATTRIB, 
Integer.toString(1));
+   conn = DriverManager.getConnection(getUrl(), props);
+   Statement stmt = conn.createStatement();
+   stmt.execute(CREATE TABLE test (ID varchar NOT NULL PRIMARY 
KEY) SPLIT ON ('EA','EZ'));
+   stmt.execute(UPSERT INTO test VALUES ('AA'));
+   stmt.execute(UPSERT INTO test VALUES ('EB'));
+

phoenix git commit: PHOENIX-1442: Alter Index double normalize Index Table Name

2014-11-12 Thread jeffreyz
Repository: phoenix
Updated Branches:
  refs/heads/4.2 3e99349b7 - bbdd9e06d


PHOENIX-1442: Alter Index double normalize Index Table Name


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

Branch: refs/heads/4.2
Commit: bbdd9e06d3eaaf2a29af4846141b83a8e8bf8470
Parents: 3e99349
Author: Jeffrey Zhong jeffr...@apache.org
Authored: Wed Nov 12 11:47:40 2014 -0800
Committer: Jeffrey Zhong jeffr...@apache.org
Committed: Wed Nov 12 11:47:40 2014 -0800

--
 .../phoenix/end2end/index/IndexMetadataIT.java  | 33 
 phoenix-core/src/main/antlr3/PhoenixSQL.g   |  2 +-
 2 files changed, 34 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/bbdd9e06/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexMetadataIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexMetadataIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexMetadataIT.java
index 2547844..fb4b827 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexMetadataIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexMetadataIT.java
@@ -342,6 +342,39 @@ public class IndexMetadataIT extends 
BaseHBaseManagedTimeIT {
 conn.close();
 }
 }
+
+@Test
+public void testAlterIndexWithLowerCaseName() throws Exception {
+Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+Connection conn = DriverManager.getConnection(getUrl(), props);
+conn.setAutoCommit(false);
+String indexName = \lowerCaseIndex\;
+try {
+ensureTableCreated(getUrl(), INDEX_DATA_TABLE);
+String ddl = CREATE INDEX  + indexName +  ON  + 
INDEX_DATA_SCHEMA + QueryConstants.NAME_SEPARATOR + INDEX_DATA_TABLE
++  (char_col1 ASC, int_col2 ASC, long_col2 DESC)
++  INCLUDE (int_col1);
+PreparedStatement stmt = conn.prepareStatement(ddl);
+stmt.execute();
+
+ddl = ALTER INDEX  + indexName +  ON  + INDEX_DATA_SCHEMA + 
QueryConstants.NAME_SEPARATOR + INDEX_DATA_TABLE +  UNUSABLE;
+conn.createStatement().execute(ddl);
+// Verify the metadata for index is correct.
+ResultSet rs = conn.getMetaData().getTables(null, 
StringUtil.escapeLike(INDEX_DATA_SCHEMA), lowerCaseIndex, new String[] 
{PTableType.INDEX.toString()});
+assertTrue(rs.next());
+assertEquals(lowerCaseIndex, rs.getString(3));
+
+ddl = DROP INDEX  + indexName +  ON  + INDEX_DATA_SCHEMA + 
QueryConstants.NAME_SEPARATOR + INDEX_DATA_TABLE;
+stmt = conn.prepareStatement(ddl);
+stmt.execute();
+
+// Assert the rows for index table is completely removed.
+rs = conn.getMetaData().getIndexInfo(null, INDEX_DATA_SCHEMA, 
INDEX_DATA_TABLE, false, false);
+assertFalse(rs.next());
+} finally {
+conn.close();
+}
+}
 
 @Test
 public void testIndexDefinitionWithRepeatedColumns() throws Exception {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/bbdd9e06/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 e2636fb..01db4b6 100644
--- a/phoenix-core/src/main/antlr3/PhoenixSQL.g
+++ b/phoenix-core/src/main/antlr3/PhoenixSQL.g
@@ -488,7 +488,7 @@ drop_index_node returns [DropIndexStatement ret]
 // Parse a alter index statement
 alter_index_node returns [AlterIndexStatement ret]
 : ALTER INDEX (IF ex=EXISTS)? i=index_name ON t=from_table_name s=(USABLE 
| UNUSABLE | REBUILD | DISABLE)
-  {ret = 
factory.alterIndex(factory.namedTable(null,factory.table(t.getSchemaName(),i.getName())),
 t.getTableName(), ex!=null, 
PIndexState.valueOf(SchemaUtil.normalizeIdentifier(s.getText(; }
+  {ret = factory.alterIndex(factory.namedTable(null, 
TableName.create(t.getSchemaName(), i.getName())), t.getTableName(), ex!=null, 
PIndexState.valueOf(SchemaUtil.normalizeIdentifier(s.getText(; }
 ;
 
 // Parse an alter table statement.



phoenix git commit: PHOENIX-1442: Alter Index double normalize Index Table Name

2014-11-12 Thread jeffreyz
Repository: phoenix
Updated Branches:
  refs/heads/master ad525844f - c8883bcca


PHOENIX-1442: Alter Index double normalize Index Table Name


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

Branch: refs/heads/master
Commit: c8883bcca2ca852bf2d6acba37159791875562b0
Parents: ad52584
Author: Jeffrey Zhong jeffr...@apache.org
Authored: Wed Nov 12 11:47:40 2014 -0800
Committer: Jeffrey Zhong jeffr...@apache.org
Committed: Wed Nov 12 12:25:20 2014 -0800

--
 .../phoenix/end2end/index/IndexMetadataIT.java  | 33 
 phoenix-core/src/main/antlr3/PhoenixSQL.g   |  2 +-
 2 files changed, 34 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/c8883bcc/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexMetadataIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexMetadataIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexMetadataIT.java
index 2547844..fb4b827 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexMetadataIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexMetadataIT.java
@@ -342,6 +342,39 @@ public class IndexMetadataIT extends 
BaseHBaseManagedTimeIT {
 conn.close();
 }
 }
+
+@Test
+public void testAlterIndexWithLowerCaseName() throws Exception {
+Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+Connection conn = DriverManager.getConnection(getUrl(), props);
+conn.setAutoCommit(false);
+String indexName = \lowerCaseIndex\;
+try {
+ensureTableCreated(getUrl(), INDEX_DATA_TABLE);
+String ddl = CREATE INDEX  + indexName +  ON  + 
INDEX_DATA_SCHEMA + QueryConstants.NAME_SEPARATOR + INDEX_DATA_TABLE
++  (char_col1 ASC, int_col2 ASC, long_col2 DESC)
++  INCLUDE (int_col1);
+PreparedStatement stmt = conn.prepareStatement(ddl);
+stmt.execute();
+
+ddl = ALTER INDEX  + indexName +  ON  + INDEX_DATA_SCHEMA + 
QueryConstants.NAME_SEPARATOR + INDEX_DATA_TABLE +  UNUSABLE;
+conn.createStatement().execute(ddl);
+// Verify the metadata for index is correct.
+ResultSet rs = conn.getMetaData().getTables(null, 
StringUtil.escapeLike(INDEX_DATA_SCHEMA), lowerCaseIndex, new String[] 
{PTableType.INDEX.toString()});
+assertTrue(rs.next());
+assertEquals(lowerCaseIndex, rs.getString(3));
+
+ddl = DROP INDEX  + indexName +  ON  + INDEX_DATA_SCHEMA + 
QueryConstants.NAME_SEPARATOR + INDEX_DATA_TABLE;
+stmt = conn.prepareStatement(ddl);
+stmt.execute();
+
+// Assert the rows for index table is completely removed.
+rs = conn.getMetaData().getIndexInfo(null, INDEX_DATA_SCHEMA, 
INDEX_DATA_TABLE, false, false);
+assertFalse(rs.next());
+} finally {
+conn.close();
+}
+}
 
 @Test
 public void testIndexDefinitionWithRepeatedColumns() throws Exception {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/c8883bcc/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 aa7fdc6..9206cf4 100644
--- a/phoenix-core/src/main/antlr3/PhoenixSQL.g
+++ b/phoenix-core/src/main/antlr3/PhoenixSQL.g
@@ -488,7 +488,7 @@ drop_index_node returns [DropIndexStatement ret]
 // Parse a alter index statement
 alter_index_node returns [AlterIndexStatement ret]
 : ALTER INDEX (IF ex=EXISTS)? i=index_name ON t=from_table_name s=(USABLE 
| UNUSABLE | REBUILD | DISABLE)
-  {ret = 
factory.alterIndex(factory.namedTable(null,factory.table(t.getSchemaName(),i.getName())),
 t.getTableName(), ex!=null, 
PIndexState.valueOf(SchemaUtil.normalizeIdentifier(s.getText(; }
+  {ret = factory.alterIndex(factory.namedTable(null, 
TableName.create(t.getSchemaName(), i.getName())), t.getTableName(), ex!=null, 
PIndexState.valueOf(SchemaUtil.normalizeIdentifier(s.getText(; }
 ;
 
 // Parse an alter table statement.



phoenix git commit: PHOENIX-1442: Alter Index double normalize Index Table Name

2014-11-12 Thread jeffreyz
Repository: phoenix
Updated Branches:
  refs/heads/3.0 b5012d994 - 9b0bb38d3


PHOENIX-1442: Alter Index double normalize Index Table Name


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

Branch: refs/heads/3.0
Commit: 9b0bb38d37873c1f0ce6fcedc314d3673e8049c4
Parents: b5012d9
Author: Jeffrey Zhong jeffr...@apache.org
Authored: Wed Nov 12 11:47:40 2014 -0800
Committer: Jeffrey Zhong jeffr...@apache.org
Committed: Wed Nov 12 12:29:33 2014 -0800

--
 .../phoenix/end2end/index/IndexMetadataIT.java  | 33 
 phoenix-core/src/main/antlr3/PhoenixSQL.g   |  2 +-
 2 files changed, 34 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/9b0bb38d/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexMetadataIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexMetadataIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexMetadataIT.java
index 2547844..fb4b827 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexMetadataIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexMetadataIT.java
@@ -342,6 +342,39 @@ public class IndexMetadataIT extends 
BaseHBaseManagedTimeIT {
 conn.close();
 }
 }
+
+@Test
+public void testAlterIndexWithLowerCaseName() throws Exception {
+Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+Connection conn = DriverManager.getConnection(getUrl(), props);
+conn.setAutoCommit(false);
+String indexName = \lowerCaseIndex\;
+try {
+ensureTableCreated(getUrl(), INDEX_DATA_TABLE);
+String ddl = CREATE INDEX  + indexName +  ON  + 
INDEX_DATA_SCHEMA + QueryConstants.NAME_SEPARATOR + INDEX_DATA_TABLE
++  (char_col1 ASC, int_col2 ASC, long_col2 DESC)
++  INCLUDE (int_col1);
+PreparedStatement stmt = conn.prepareStatement(ddl);
+stmt.execute();
+
+ddl = ALTER INDEX  + indexName +  ON  + INDEX_DATA_SCHEMA + 
QueryConstants.NAME_SEPARATOR + INDEX_DATA_TABLE +  UNUSABLE;
+conn.createStatement().execute(ddl);
+// Verify the metadata for index is correct.
+ResultSet rs = conn.getMetaData().getTables(null, 
StringUtil.escapeLike(INDEX_DATA_SCHEMA), lowerCaseIndex, new String[] 
{PTableType.INDEX.toString()});
+assertTrue(rs.next());
+assertEquals(lowerCaseIndex, rs.getString(3));
+
+ddl = DROP INDEX  + indexName +  ON  + INDEX_DATA_SCHEMA + 
QueryConstants.NAME_SEPARATOR + INDEX_DATA_TABLE;
+stmt = conn.prepareStatement(ddl);
+stmt.execute();
+
+// Assert the rows for index table is completely removed.
+rs = conn.getMetaData().getIndexInfo(null, INDEX_DATA_SCHEMA, 
INDEX_DATA_TABLE, false, false);
+assertFalse(rs.next());
+} finally {
+conn.close();
+}
+}
 
 @Test
 public void testIndexDefinitionWithRepeatedColumns() throws Exception {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/9b0bb38d/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 285acf7..95d51b4 100644
--- a/phoenix-core/src/main/antlr3/PhoenixSQL.g
+++ b/phoenix-core/src/main/antlr3/PhoenixSQL.g
@@ -489,7 +489,7 @@ drop_index_node returns [DropIndexStatement ret]
 // Parse a alter index statement
 alter_index_node returns [AlterIndexStatement ret]
 : ALTER INDEX (IF ex=EXISTS)? i=index_name ON t=from_table_name s=(USABLE 
| UNUSABLE | REBUILD | DISABLE)
-  {ret = 
factory.alterIndex(factory.namedTable(null,factory.table(t.getSchemaName(),i.getName())),
 t.getTableName(), ex!=null, 
PIndexState.valueOf(SchemaUtil.normalizeIdentifier(s.getText(; }
+  {ret = factory.alterIndex(factory.namedTable(null, 
TableName.create(t.getSchemaName(), i.getName())), t.getTableName(), ex!=null, 
PIndexState.valueOf(SchemaUtil.normalizeIdentifier(s.getText(; }
 ;
 
 // Parse an alter table statement.



phoenix git commit: PHOENIX-1442: Alter Index double normalize Index Table Name

2014-11-12 Thread jeffreyz
Repository: phoenix
Updated Branches:
  refs/heads/3.2 f37f394bb - 24246943a


PHOENIX-1442: Alter Index double normalize Index Table Name


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

Branch: refs/heads/3.2
Commit: 24246943a546a7d34a1e649c2eebb58316ce50e5
Parents: f37f394
Author: Jeffrey Zhong jeffr...@apache.org
Authored: Wed Nov 12 11:47:40 2014 -0800
Committer: Jeffrey Zhong jeffr...@apache.org
Committed: Wed Nov 12 12:31:00 2014 -0800

--
 .../phoenix/end2end/index/IndexMetadataIT.java  | 33 
 phoenix-core/src/main/antlr3/PhoenixSQL.g   |  2 +-
 2 files changed, 34 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/24246943/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexMetadataIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexMetadataIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexMetadataIT.java
index 2547844..fb4b827 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexMetadataIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexMetadataIT.java
@@ -342,6 +342,39 @@ public class IndexMetadataIT extends 
BaseHBaseManagedTimeIT {
 conn.close();
 }
 }
+
+@Test
+public void testAlterIndexWithLowerCaseName() throws Exception {
+Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+Connection conn = DriverManager.getConnection(getUrl(), props);
+conn.setAutoCommit(false);
+String indexName = \lowerCaseIndex\;
+try {
+ensureTableCreated(getUrl(), INDEX_DATA_TABLE);
+String ddl = CREATE INDEX  + indexName +  ON  + 
INDEX_DATA_SCHEMA + QueryConstants.NAME_SEPARATOR + INDEX_DATA_TABLE
++  (char_col1 ASC, int_col2 ASC, long_col2 DESC)
++  INCLUDE (int_col1);
+PreparedStatement stmt = conn.prepareStatement(ddl);
+stmt.execute();
+
+ddl = ALTER INDEX  + indexName +  ON  + INDEX_DATA_SCHEMA + 
QueryConstants.NAME_SEPARATOR + INDEX_DATA_TABLE +  UNUSABLE;
+conn.createStatement().execute(ddl);
+// Verify the metadata for index is correct.
+ResultSet rs = conn.getMetaData().getTables(null, 
StringUtil.escapeLike(INDEX_DATA_SCHEMA), lowerCaseIndex, new String[] 
{PTableType.INDEX.toString()});
+assertTrue(rs.next());
+assertEquals(lowerCaseIndex, rs.getString(3));
+
+ddl = DROP INDEX  + indexName +  ON  + INDEX_DATA_SCHEMA + 
QueryConstants.NAME_SEPARATOR + INDEX_DATA_TABLE;
+stmt = conn.prepareStatement(ddl);
+stmt.execute();
+
+// Assert the rows for index table is completely removed.
+rs = conn.getMetaData().getIndexInfo(null, INDEX_DATA_SCHEMA, 
INDEX_DATA_TABLE, false, false);
+assertFalse(rs.next());
+} finally {
+conn.close();
+}
+}
 
 @Test
 public void testIndexDefinitionWithRepeatedColumns() throws Exception {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/24246943/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 4a3a8d8..697ff44 100644
--- a/phoenix-core/src/main/antlr3/PhoenixSQL.g
+++ b/phoenix-core/src/main/antlr3/PhoenixSQL.g
@@ -489,7 +489,7 @@ drop_index_node returns [DropIndexStatement ret]
 // Parse a alter index statement
 alter_index_node returns [AlterIndexStatement ret]
 : ALTER INDEX (IF ex=EXISTS)? i=index_name ON t=from_table_name s=(USABLE 
| UNUSABLE | REBUILD | DISABLE)
-  {ret = 
factory.alterIndex(factory.namedTable(null,factory.table(t.getSchemaName(),i.getName())),
 t.getTableName(), ex!=null, 
PIndexState.valueOf(SchemaUtil.normalizeIdentifier(s.getText(; }
+  {ret = factory.alterIndex(factory.namedTable(null, 
TableName.create(t.getSchemaName(), i.getName())), t.getTableName(), ex!=null, 
PIndexState.valueOf(SchemaUtil.normalizeIdentifier(s.getText(; }
 ;
 
 // Parse an alter table statement.



git commit: PHOENIX-1346: Base exception gets wrapped as incompatible jar exception (Mujtaba Chohan)

2014-11-05 Thread jeffreyz
Repository: phoenix
Updated Branches:
  refs/heads/master 237c55614 - c0e0b2b5b


PHOENIX-1346: Base exception gets wrapped as incompatible jar exception 
(Mujtaba Chohan)


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

Branch: refs/heads/master
Commit: c0e0b2b5bc4c0bf2ce898bdfd4e2110e0fecc6ab
Parents: 237c556
Author: Jeffrey Zhong jeffr...@apache.org
Authored: Wed Nov 5 10:08:49 2014 -0800
Committer: Jeffrey Zhong jeffr...@apache.org
Committed: Wed Nov 5 10:08:55 2014 -0800

--
 .../java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java | 2 ++
 1 file changed, 2 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/c0e0b2b5/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 821f7fc..780e34a 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
@@ -885,6 +885,8 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 }
 }
 lowestClusterHBaseVersion = minHBaseVersion;
+} catch (SQLException e) {
+throw e;
 } catch (Throwable t) {
 // This is the case if the phoenix.jar is not on the classpath 
of HBase on the region server
 throw new 
SQLExceptionInfo.Builder(SQLExceptionCode.INCOMPATIBLE_CLIENT_SERVER_JAR).setRootCause(t)



git commit: PHOENIX-1346: Base exception gets wrapped as incompatible jar exception (Mujtaba Chohan)

2014-11-05 Thread jeffreyz
Repository: phoenix
Updated Branches:
  refs/heads/4.0 9bc0d6bbb - 497224df6


PHOENIX-1346: Base exception gets wrapped as incompatible jar exception 
(Mujtaba Chohan)


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

Branch: refs/heads/4.0
Commit: 497224df62930aca3c2416b1a2398557aacbc637
Parents: 9bc0d6b
Author: Jeffrey Zhong jeffr...@apache.org
Authored: Wed Nov 5 10:08:49 2014 -0800
Committer: Jeffrey Zhong jeffr...@apache.org
Committed: Wed Nov 5 10:11:04 2014 -0800

--
 .../java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java | 2 ++
 1 file changed, 2 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/497224df/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 eab263b..4aa1bac 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
@@ -885,6 +885,8 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 }
 }
 lowestClusterHBaseVersion = minHBaseVersion;
+} catch (SQLException e) {
+throw e;
 } catch (Throwable t) {
 // This is the case if the phoenix.jar is not on the classpath 
of HBase on the region server
 throw new 
SQLExceptionInfo.Builder(SQLExceptionCode.INCOMPATIBLE_CLIENT_SERVER_JAR).setRootCause(t)



[1/2] git commit: Revert PHOENIX-1346: Base exception gets wrapped as incompatible jar exception (Mujtaba Chohan)

2014-11-05 Thread jeffreyz
Repository: phoenix
Updated Branches:
  refs/heads/4.0 497224df6 - 96b1b9128


Revert PHOENIX-1346: Base exception gets wrapped as incompatible jar exception 
(Mujtaba Chohan)

This reverts commit c0e0b2b5bc4c0bf2ce898bdfd4e2110e0fecc6ab.


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

Branch: refs/heads/4.0
Commit: d8ca15c6172d989bb031a785d51c1a5306c14aef
Parents: 497224d
Author: Jeffrey Zhong jeffr...@apache.org
Authored: Wed Nov 5 11:03:59 2014 -0800
Committer: Jeffrey Zhong jeffr...@apache.org
Committed: Wed Nov 5 11:08:18 2014 -0800

--
 .../java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java | 2 --
 1 file changed, 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/d8ca15c6/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 4aa1bac..eab263b 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
@@ -885,8 +885,6 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 }
 }
 lowestClusterHBaseVersion = minHBaseVersion;
-} catch (SQLException e) {
-throw e;
 } catch (Throwable t) {
 // This is the case if the phoenix.jar is not on the classpath 
of HBase on the region server
 throw new 
SQLExceptionInfo.Builder(SQLExceptionCode.INCOMPATIBLE_CLIENT_SERVER_JAR).setRootCause(t)



[2/2] git commit: PHOENIX-1346: Base exception gets wrapped as incompatible jar exception (Samarth Jain)

2014-11-05 Thread jeffreyz
PHOENIX-1346: Base exception gets wrapped as incompatible jar exception 
(Samarth Jain)


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

Branch: refs/heads/4.0
Commit: 96b1b912830423743feefc0b48e6a0e71c992d39
Parents: d8ca15c
Author: Jeffrey Zhong jeffr...@apache.org
Authored: Wed Nov 5 11:05:00 2014 -0800
Committer: Jeffrey Zhong jeffr...@apache.org
Committed: Wed Nov 5 11:08:25 2014 -0800

--
 .../java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java | 2 ++
 1 file changed, 2 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/96b1b912/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 eab263b..4aa1bac 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
@@ -885,6 +885,8 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 }
 }
 lowestClusterHBaseVersion = minHBaseVersion;
+} catch (SQLException e) {
+throw e;
 } catch (Throwable t) {
 // This is the case if the phoenix.jar is not on the classpath 
of HBase on the region server
 throw new 
SQLExceptionInfo.Builder(SQLExceptionCode.INCOMPATIBLE_CLIENT_SERVER_JAR).setRootCause(t)



[2/2] git commit: PHOENIX-1346: Base exception gets wrapped as incompatible jar exception (Samarth Jain)

2014-11-05 Thread jeffreyz
PHOENIX-1346: Base exception gets wrapped as incompatible jar exception 
(Samarth Jain)


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

Branch: refs/heads/3.0
Commit: 9ffd8c63a8d1875ba672eae57be8b7cd29176450
Parents: ff0a074
Author: Jeffrey Zhong jeffr...@apache.org
Authored: Wed Nov 5 11:05:00 2014 -0800
Committer: Jeffrey Zhong jeffr...@apache.org
Committed: Wed Nov 5 11:10:45 2014 -0800

--
 .../java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java | 2 ++
 1 file changed, 2 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/9ffd8c63/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 c53c19b..31d46e0 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
@@ -851,6 +851,8 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 }
 }
 lowestClusterHBaseVersion = minHBaseVersion;
+} catch (SQLException e) {
+throw e;
 } catch (Throwable t) {
 // This is the case if the phoenix.jar is not on the classpath 
of HBase on the region server
 throw new 
SQLExceptionInfo.Builder(SQLExceptionCode.INCOMPATIBLE_CLIENT_SERVER_JAR).setRootCause(t)



git commit: PHOENIX-1346: Base exception gets wrapped as incompatible jar exception (Samarth Jain)

2014-11-05 Thread jeffreyz
Repository: phoenix
Updated Branches:
  refs/heads/3.2 73b570e13 - 2a674dd01


PHOENIX-1346: Base exception gets wrapped as incompatible jar exception 
(Samarth Jain)


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

Branch: refs/heads/3.2
Commit: 2a674dd01d1eb11c62cb40a350e196aa083b9a6c
Parents: 73b570e
Author: Jeffrey Zhong jeffr...@apache.org
Authored: Wed Nov 5 11:05:00 2014 -0800
Committer: Jeffrey Zhong jeffr...@apache.org
Committed: Wed Nov 5 14:40:01 2014 -0800

--
 .../java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java | 2 ++
 1 file changed, 2 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/2a674dd0/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 c53c19b..31d46e0 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
@@ -851,6 +851,8 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 }
 }
 lowestClusterHBaseVersion = minHBaseVersion;
+} catch (SQLException e) {
+throw e;
 } catch (Throwable t) {
 // This is the case if the phoenix.jar is not on the classpath 
of HBase on the region server
 throw new 
SQLExceptionInfo.Builder(SQLExceptionCode.INCOMPATIBLE_CLIENT_SERVER_JAR).setRootCause(t)



[2/2] git commit: PHOENIX-1396: Avoid unnecessary ResultSpooler.bin files creation/deletion every time SpoolingResultIterator is used

2014-11-05 Thread jeffreyz
PHOENIX-1396: Avoid unnecessary ResultSpooler.bin files creation/deletion every 
time SpoolingResultIterator is used


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

Branch: refs/heads/4.2
Commit: 2b181d325cccfb634c37690666977706d6e64a42
Parents: 2c3b350
Author: Jeffrey Zhong jeffr...@apache.org
Authored: Wed Nov 5 09:56:19 2014 -0800
Committer: Jeffrey Zhong jeffr...@apache.org
Committed: Wed Nov 5 14:42:59 2014 -0800

--
 .../phoenix/iterate/SpoolingResultIterator.java| 17 +
 1 file changed, 9 insertions(+), 8 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/2b181d32/phoenix-core/src/main/java/org/apache/phoenix/iterate/SpoolingResultIterator.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/iterate/SpoolingResultIterator.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/SpoolingResultIterator.java
index 0ba6554..2a5080e 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/iterate/SpoolingResultIterator.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/SpoolingResultIterator.java
@@ -88,14 +88,12 @@ public class SpoolingResultIterator implements 
PeekingResultIterator {
 */
 SpoolingResultIterator(ResultIterator scanner, MemoryManager mm, final int 
thresholdBytes, final long maxSpoolToDisk, final String spoolDirectory) throws 
SQLException {
 boolean success = false;
-boolean usedOnDiskIterator = false;
 final MemoryChunk chunk = mm.allocate(0, thresholdBytes);
-File tempFile = null;
+DeferredFileOutputStream spoolTo = null;
 try {
 // Can't be bigger than int, since it's the max of the above 
allocation
 int size = (int)chunk.getSize();
-tempFile = File.createTempFile(ResultSpooler,.bin, new 
File(spoolDirectory));
-DeferredFileOutputStream spoolTo = new 
DeferredFileOutputStream(size, tempFile) {
+spoolTo = new DeferredFileOutputStream(size, 
ResultSpooler,.bin, new File(spoolDirectory)) {
 @Override
 protected void thresholdReached() throws IOException {
 super.thresholdReached();
@@ -115,14 +113,12 @@ public class SpoolingResultIterator implements 
PeekingResultIterator {
 }
 maxSize = Math.max(length, maxSize);
 }
-spoolTo.close();
 if (spoolTo.isInMemory()) {
 byte[] data = spoolTo.getData();
 chunk.resize(data.length);
 spoolFrom = new InMemoryResultIterator(data, chunk);
 } else {
 spoolFrom = new OnDiskResultIterator(maxSize, 
spoolTo.getFile());
-usedOnDiskIterator = true;
 }
 success = true;
 } catch (IOException e) {
@@ -132,9 +128,14 @@ public class SpoolingResultIterator implements 
PeekingResultIterator {
 scanner.close();
 } finally {
 try {
-if (!usedOnDiskIterator  tempFile != null) {
-tempFile.delete();
+if (spoolTo != null) {
+if(!success  spoolTo.getFile() != null){
+spoolTo.getFile().delete();
+}
+spoolTo.close();
 }
+} catch (IOException ignored) {
+  // ignore close error
 } finally {
 if (!success) {
 chunk.close();



git commit: PHOENIX-1382: Phoenix 4.2 RC Issue

2014-10-26 Thread jeffreyz
Repository: phoenix
Updated Branches:
  refs/heads/4.0 553fb4b33 - 00522cfd3


PHOENIX-1382: Phoenix 4.2 RC Issue


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

Branch: refs/heads/4.0
Commit: 00522cfd3fee98336be442ae9c4696a8c657ddc2
Parents: 553fb4b
Author: Jeffrey Zhong jeffr...@apache.org
Authored: Sun Oct 26 22:07:13 2014 -0700
Committer: Jeffrey Zhong jeffr...@apache.org
Committed: Sun Oct 26 22:07:13 2014 -0700

--
 bin/phoenix_utils.py   | 2 +-
 .../main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/00522cfd/bin/phoenix_utils.py
--
diff --git a/bin/phoenix_utils.py b/bin/phoenix_utils.py
index 4f7d9c3..2331ae9 100755
--- a/bin/phoenix_utils.py
+++ b/bin/phoenix_utils.py
@@ -49,7 +49,7 @@ def findFileInPathWithoutRecursion(pattern, path):
 return 
 
 def setPath():
- PHOENIX_CLIENT_JAR_PATTERN = phoenix-*-client*.jar
+ PHOENIX_CLIENT_JAR_PATTERN = phoenix-*-client.jar
  PHOENIX_TESTS_JAR_PATTERN = phoenix-*-tests*.jar
  global current_dir
  current_dir = os.path.dirname(os.path.abspath(__file__))

http://git-wip-us.apache.org/repos/asf/phoenix/blob/00522cfd/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 ac1287a..662bed3 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
@@ -52,7 +52,7 @@ import com.google.protobuf.HBaseZeroCopyByteString;
  */
 public abstract class MetaDataProtocol extends MetaDataService {
 public static final int PHOENIX_MAJOR_VERSION = 4;
-public static final int PHOENIX_MINOR_VERSION = 1;
+public static final int PHOENIX_MINOR_VERSION = 2;
 public static final int PHOENIX_PATCH_NUMBER = 0;
 public static final int PHOENIX_VERSION = 
 VersionUtil.encodeVersion(PHOENIX_MAJOR_VERSION, 
PHOENIX_MINOR_VERSION, PHOENIX_PATCH_NUMBER);



git commit: PHOENIX-1373: Ctrl-C out of sqlline causes terminal to be useless

2014-10-23 Thread jeffreyz
Repository: phoenix
Updated Branches:
  refs/heads/4.0 6a28b7d24 - e8a0355a4


PHOENIX-1373: Ctrl-C out of sqlline causes terminal to be useless


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

Branch: refs/heads/4.0
Commit: e8a0355a4734beaf69998754f617172974b46670
Parents: 6a28b7d
Author: Jeffrey Zhong jeffr...@apache.org
Authored: Thu Oct 23 17:34:43 2014 -0700
Committer: Jeffrey Zhong jeffr...@apache.org
Committed: Thu Oct 23 17:34:43 2014 -0700

--
 bin/sqlline.py | 2 ++
 1 file changed, 2 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/e8a0355a/bin/sqlline.py
--
diff --git a/bin/sqlline.py b/bin/sqlline.py
index d41c2e7..f48e527 100755
--- a/bin/sqlline.py
+++ b/bin/sqlline.py
@@ -31,6 +31,8 @@ def kill_child():
 if childProc is not None:
 childProc.terminate()
 childProc.kill()
+if os.name != 'nt':
+os.system(reset)
 atexit.register(kill_child)
 
 phoenix_utils.setPath()



git commit: PHOENIX-1360: NPE in SpoolingResultIterator

2014-10-19 Thread jeffreyz
Repository: phoenix
Updated Branches:
  refs/heads/master cf41cc635 - b8f32aeaa


PHOENIX-1360: NPE in SpoolingResultIterator


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

Branch: refs/heads/master
Commit: b8f32aeaa735689f231268d7c790efbd6051d7f4
Parents: cf41cc6
Author: Jeffrey Zhong jeffr...@apache.org
Authored: Sun Oct 19 21:34:23 2014 -0700
Committer: Jeffrey Zhong jeffr...@apache.org
Committed: Sun Oct 19 21:39:19 2014 -0700

--
 .../java/org/apache/phoenix/iterate/SpoolingResultIterator.java| 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/b8f32aea/phoenix-core/src/main/java/org/apache/phoenix/iterate/SpoolingResultIterator.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/iterate/SpoolingResultIterator.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/SpoolingResultIterator.java
index 42a61a7..0ba6554 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/iterate/SpoolingResultIterator.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/SpoolingResultIterator.java
@@ -132,7 +132,7 @@ public class SpoolingResultIterator implements 
PeekingResultIterator {
 scanner.close();
 } finally {
 try {
-if (!usedOnDiskIterator) {
+if (!usedOnDiskIterator  tempFile != null) {
 tempFile.delete();
 }
 } finally {



git commit: PHOENIX-1355: sqlline.py or psql.py may hang if they're not invoked from bin folder

2014-10-19 Thread jeffreyz
Repository: phoenix
Updated Branches:
  refs/heads/master 571c594df - cf41cc635


PHOENIX-1355: sqlline.py or psql.py may hang if they're not invoked from bin 
folder


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

Branch: refs/heads/master
Commit: cf41cc63594ac7d8f3d831511215519fe43afea0
Parents: 571c594
Author: Jeffrey Zhong jeffr...@apache.org
Authored: Sun Oct 19 21:22:57 2014 -0700
Committer: Jeffrey Zhong jeffr...@apache.org
Committed: Sun Oct 19 21:27:08 2014 -0700

--
 bin/end2endTest.py   | 16 ++--
 bin/phoenix_utils.py | 34 +-
 bin/psql.py  |  2 +-
 bin/sqlline.py   |  2 +-
 4 files changed, 41 insertions(+), 13 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/cf41cc63/bin/end2endTest.py
--
diff --git a/bin/end2endTest.py b/bin/end2endTest.py
index f35cc21..96886c7 100755
--- a/bin/end2endTest.py
+++ b/bin/end2endTest.py
@@ -19,19 +19,23 @@
 #
 
 
+# !!!  PLEASE READ !!!
+# !!!  Do NOT run the script against a prodcution cluster because it wipes out
+# !!!  existing data of the cluster 
+
 import os
 import subprocess
 import sys
+import phoenix_utils
+
+phoenix_utils.setPath()
 
-current_dir = os.path.dirname(os.path.abspath(__file__))
-phoenix_jar_path = os.getenv('PHOENIX_LIB_DIR',
- os.path.join(current_dir, .., phoenix-core,
-  target, *))
+phoenix_jar_path = os.getenv(phoenix_utils.phoenix_class_path, 
phoenix_utils.phoenix_test_jar_path)
 
 # HBase configuration folder path (where hbase-site.xml reside) for
 # HBase/Phoenix client side property override
-hbase_config_path = os.getenv('HBASE_CONF_DIR', current_dir)
-hbase_library_path = os.getenv('HBASE_LIBRARY_DIR', current_dir)
+hbase_config_path = os.getenv('HBASE_CONF_DIR', phoenix_utils.hbase_conf_path)
+hbase_library_path = os.getenv('HBASE_LIBRARY_DIR', '')
 
 print Current ClassPath=%s:%s:%s % (hbase_config_path, phoenix_jar_path,
   hbase_library_path)

http://git-wip-us.apache.org/repos/asf/phoenix/blob/cf41cc63/bin/phoenix_utils.py
--
diff --git a/bin/phoenix_utils.py b/bin/phoenix_utils.py
index 418e387..4f7d9c3 100755
--- a/bin/phoenix_utils.py
+++ b/bin/phoenix_utils.py
@@ -39,23 +39,47 @@ def find(pattern, classPaths):
 
 return 
 
+def findFileInPathWithoutRecursion(pattern, path):
+
+files = [f for f in os.listdir(path) if 
os.path.isfile(os.path.join(path,f))]
+for name in files:
+if fnmatch.fnmatch(name, pattern):
+return os.path.join(path, name)
+
+return 
 
 def setPath():
+ PHOENIX_CLIENT_JAR_PATTERN = phoenix-*-client*.jar
+ PHOENIX_TESTS_JAR_PATTERN = phoenix-*-tests*.jar
  global current_dir
  current_dir = os.path.dirname(os.path.abspath(__file__))
  global phoenix_jar_path
- phoenix_jar_path = os.path.join(current_dir, .., phoenix-assembly, 
target)
+ phoenix_jar_path = os.path.join(current_dir, .., phoenix-assembly, 
target,*)
  global phoenix_client_jar
  phoenix_client_jar = find(phoenix-*-client.jar, phoenix_jar_path)
  global phoenix_test_jar_path
- phoenix_test_jar_path = os.path.join(current_dir, .., phoenix-core, 
target)
+ phoenix_test_jar_path = os.path.join(current_dir, .., phoenix-core, 
target,*)
+ global hbase_conf_path
+ hbase_conf_path = os.getenv('HBASE_CONF_PATH','.')
  global testjar
- testjar = find(phoenix-*-tests.jar, phoenix_test_jar_path)
+ testjar = find(PHOENIX_TESTS_JAR_PATTERN, phoenix_test_jar_path)
+
+ if phoenix_client_jar == :
+ phoenix_client_jar = 
findFileInPathWithoutRecursion(PHOENIX_CLIENT_JAR_PATTERN, 
os.path.join(current_dir, ..))
+
+ if testjar == :
+ testjar = findFileInPathWithoutRecursion(PHOENIX_TESTS_JAR_PATTERN, 
os.path.join(current_dir, ..))
+
+ # Backward support old env variable PHOENIX_LIB_DIR replaced by 
PHOENIX_CLASS_PATH
+ global phoenix_class_path
+ phoenix_class_path = os.getenv('PHOENIX_LIB_DIR','')
+ if phoenix_class_path == :
+ phoenix_class_path = os.getenv('PHOENIX_CLASS_PATH','')
 
  if phoenix_client_jar == :
-phoenix_client_jar = find(phoenix-*-client*, os.path.join(current_dir, 
..))
+ phoenix_client_jar = find(PHOENIX_CLIENT_JAR_PATTERN, phoenix_class_path)
 
  if testjar == :
-testjar = find(phoenix-*-test*, os.path.join(current_dir, ..))
+ testjar = find(PHOENIX_TESTS_JAR_PATTERN, phoenix_class_path)
 
  return 


git commit: PHOENIX-1242: ArrayoutofBoundException Phoenix mapping to exisiting Hbase (Alicia Ying Shu)

2014-10-18 Thread jeffreyz
Repository: phoenix
Updated Branches:
  refs/heads/4.0 5fe65d190 - e7b30b2f7


PHOENIX-1242: ArrayoutofBoundException Phoenix mapping to exisiting Hbase 
(Alicia Ying Shu)


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

Branch: refs/heads/4.0
Commit: e7b30b2f77d8e444728414765ef4854d925e58a6
Parents: 5fe65d1
Author: Jeffrey Zhong jeffr...@apache.org
Authored: Sat Oct 18 15:27:57 2014 -0700
Committer: Jeffrey Zhong jeffr...@apache.org
Committed: Sat Oct 18 15:29:44 2014 -0700

--
 .../org/apache/phoenix/schema/PDataType.java| 208 +++
 .../schema/MappingTableDataTypeTest.java| 119 +++
 2 files changed, 241 insertions(+), 86 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/e7b30b2f/phoenix-core/src/main/java/org/apache/phoenix/schema/PDataType.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/PDataType.java 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/PDataType.java
index fa588b8..c1d1936 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/PDataType.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/PDataType.java
@@ -5894,25 +5894,31 @@ public enum PDataType {
 
 @Override
 public long decodeLong(byte[] bytes, int o, SortOrder sortOrder) {
-   Preconditions.checkNotNull(sortOrder);
-long v;
-byte b = bytes[o];
+  Preconditions.checkNotNull(sortOrder);
+  long v = 0L;
+  byte b = bytes[o];
+  try {
 if (sortOrder == SortOrder.ASC) {
-v = b ^ 0x80; // Flip sign bit back
-for (int i = 1; i  Bytes.SIZEOF_LONG; i++) {
-b = bytes[o + i];
-v = (v  8) + (b  0xff);
-}
+  v = b ^ 0x80; // Flip sign bit back
+  for (int i = 1; i  Bytes.SIZEOF_LONG; i++) {
+b = bytes[o + i];
+v = (v  8) + (b  0xff);
+  }
 } else {
-b = (byte)(b ^ 0xff);
-v = b ^ 0x80; // Flip sign bit back
-for (int i = 1; i  Bytes.SIZEOF_LONG; i++) {
-b = bytes[o + i];
-b ^= 0xff;
-v = (v  8) + (b  0xff);
-}
+  b = (byte) (b ^ 0xff);
+  v = b ^ 0x80; // Flip sign bit back
+  for (int i = 1; i  Bytes.SIZEOF_LONG; i++) {
+b = bytes[o + i];
+b ^= 0xff;
+v = (v  8) + (b  0xff);
+  }
 }
-return v;
+  } catch (RuntimeException e) {
+if (e instanceof ArrayIndexOutOfBoundsException) {
+  throw new IllegalDataException(cannot coerced to data type 
LONG);
+}
+  }
+  return v;
 }
 
 
@@ -6017,17 +6023,23 @@ public enum PDataType {
 @Override
 public int decodeInt(byte[] bytes, int o, SortOrder sortOrder) {
Preconditions.checkNotNull(sortOrder);
-int v;
-if (sortOrder == SortOrder.ASC) {
+int v = 0;
+try {
+  if (sortOrder == SortOrder.ASC) {
 v = bytes[o] ^ 0x80; // Flip sign bit back
 for (int i = 1; i  Bytes.SIZEOF_INT; i++) {
-v = (v  8) + (bytes[o + i]  0xff);
+  v = (v  8) + (bytes[o + i]  0xff);
 }
-} else { 
+  } else { 
 v = bytes[o] ^ 0xff ^ 0x80; // Flip sign bit back
 for (int i = 1; i  Bytes.SIZEOF_INT; i++) {
-v = (v  8) + ((bytes[o + i] ^ 0xff)  0xff);
+  v = (v  8) + ((bytes[o + i] ^ 0xff)  0xff);
 }
+  }
+} catch (RuntimeException e) {
+  if (e instanceof ArrayIndexOutOfBoundsException) {
+throw new IllegalDataException(cannot coerced to data type 
INT);
+  }
 }
 return v;
 }
@@ -6130,18 +6142,24 @@ public enum PDataType {
 
   @Override
   public short decodeShort(byte[] b, int o, SortOrder sortOrder) {
-   Preconditions.checkNotNull(sortOrder);
-int v;
-if (sortOrder == SortOrder.ASC) {
+Preconditions.checkNotNull(sortOrder);
+int v = 0;
+try {
+  if (sortOrder == SortOrder.ASC) {
 v = b[o] ^ 0x80; // Flip sign bit back
 for (int i = 1; i  Bytes.SIZEOF_SHORT; i++) {
-v = (v  

git commit: PHOENIX-1242: ArrayoutofBoundException Phoenix mapping to exisiting Hbase (Alicia Ying Shu)

2014-10-18 Thread jeffreyz
Repository: phoenix
Updated Branches:
  refs/heads/3.0 7f78ad84d - 8aeb7a7a7


PHOENIX-1242: ArrayoutofBoundException Phoenix mapping to exisiting Hbase 
(Alicia Ying Shu)


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

Branch: refs/heads/3.0
Commit: 8aeb7a7a70ae6f8033284a911a367c8498e7ed83
Parents: 7f78ad8
Author: Jeffrey Zhong jeffr...@apache.org
Authored: Sat Oct 18 15:27:57 2014 -0700
Committer: Jeffrey Zhong jeffr...@apache.org
Committed: Sat Oct 18 15:34:17 2014 -0700

--
 .../org/apache/phoenix/schema/PDataType.java| 208 +++
 .../schema/MappingTableDataTypeTest.java| 119 +++
 2 files changed, 241 insertions(+), 86 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/8aeb7a7a/phoenix-core/src/main/java/org/apache/phoenix/schema/PDataType.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/PDataType.java 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/PDataType.java
index fa588b8..c1d1936 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/PDataType.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/PDataType.java
@@ -5894,25 +5894,31 @@ public enum PDataType {
 
 @Override
 public long decodeLong(byte[] bytes, int o, SortOrder sortOrder) {
-   Preconditions.checkNotNull(sortOrder);
-long v;
-byte b = bytes[o];
+  Preconditions.checkNotNull(sortOrder);
+  long v = 0L;
+  byte b = bytes[o];
+  try {
 if (sortOrder == SortOrder.ASC) {
-v = b ^ 0x80; // Flip sign bit back
-for (int i = 1; i  Bytes.SIZEOF_LONG; i++) {
-b = bytes[o + i];
-v = (v  8) + (b  0xff);
-}
+  v = b ^ 0x80; // Flip sign bit back
+  for (int i = 1; i  Bytes.SIZEOF_LONG; i++) {
+b = bytes[o + i];
+v = (v  8) + (b  0xff);
+  }
 } else {
-b = (byte)(b ^ 0xff);
-v = b ^ 0x80; // Flip sign bit back
-for (int i = 1; i  Bytes.SIZEOF_LONG; i++) {
-b = bytes[o + i];
-b ^= 0xff;
-v = (v  8) + (b  0xff);
-}
+  b = (byte) (b ^ 0xff);
+  v = b ^ 0x80; // Flip sign bit back
+  for (int i = 1; i  Bytes.SIZEOF_LONG; i++) {
+b = bytes[o + i];
+b ^= 0xff;
+v = (v  8) + (b  0xff);
+  }
 }
-return v;
+  } catch (RuntimeException e) {
+if (e instanceof ArrayIndexOutOfBoundsException) {
+  throw new IllegalDataException(cannot coerced to data type 
LONG);
+}
+  }
+  return v;
 }
 
 
@@ -6017,17 +6023,23 @@ public enum PDataType {
 @Override
 public int decodeInt(byte[] bytes, int o, SortOrder sortOrder) {
Preconditions.checkNotNull(sortOrder);
-int v;
-if (sortOrder == SortOrder.ASC) {
+int v = 0;
+try {
+  if (sortOrder == SortOrder.ASC) {
 v = bytes[o] ^ 0x80; // Flip sign bit back
 for (int i = 1; i  Bytes.SIZEOF_INT; i++) {
-v = (v  8) + (bytes[o + i]  0xff);
+  v = (v  8) + (bytes[o + i]  0xff);
 }
-} else { 
+  } else { 
 v = bytes[o] ^ 0xff ^ 0x80; // Flip sign bit back
 for (int i = 1; i  Bytes.SIZEOF_INT; i++) {
-v = (v  8) + ((bytes[o + i] ^ 0xff)  0xff);
+  v = (v  8) + ((bytes[o + i] ^ 0xff)  0xff);
 }
+  }
+} catch (RuntimeException e) {
+  if (e instanceof ArrayIndexOutOfBoundsException) {
+throw new IllegalDataException(cannot coerced to data type 
INT);
+  }
 }
 return v;
 }
@@ -6130,18 +6142,24 @@ public enum PDataType {
 
   @Override
   public short decodeShort(byte[] b, int o, SortOrder sortOrder) {
-   Preconditions.checkNotNull(sortOrder);
-int v;
-if (sortOrder == SortOrder.ASC) {
+Preconditions.checkNotNull(sortOrder);
+int v = 0;
+try {
+  if (sortOrder == SortOrder.ASC) {
 v = b[o] ^ 0x80; // Flip sign bit back
 for (int i = 1; i  Bytes.SIZEOF_SHORT; i++) {
-v = (v  

git commit: PHOENIX-1242: ArrayoutofBoundException Phoenix mapping to exisiting Hbase (Alicia Ying Shu) - Addendum

2014-10-18 Thread jeffreyz
Repository: phoenix
Updated Branches:
  refs/heads/3.0 8aeb7a7a7 - ae4863ab5


PHOENIX-1242: ArrayoutofBoundException Phoenix mapping to exisiting Hbase 
(Alicia Ying Shu) - Addendum


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

Branch: refs/heads/3.0
Commit: ae4863ab52f26d7584094a347d274dd380e62599
Parents: 8aeb7a7
Author: Jeffrey Zhong jeffr...@apache.org
Authored: Sat Oct 18 18:00:25 2014 -0700
Committer: Jeffrey Zhong jeffr...@apache.org
Committed: Sat Oct 18 18:00:25 2014 -0700

--
 .../org/apache/phoenix/schema/MappingTableDataTypeTest.java   | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/ae4863ab/phoenix-core/src/test/java/org/apache/phoenix/schema/MappingTableDataTypeTest.java
--
diff --git 
a/phoenix-core/src/test/java/org/apache/phoenix/schema/MappingTableDataTypeTest.java
 
b/phoenix-core/src/test/java/org/apache/phoenix/schema/MappingTableDataTypeTest.java
index 64df35f..a787b13 100644
--- 
a/phoenix-core/src/test/java/org/apache/phoenix/schema/MappingTableDataTypeTest.java
+++ 
b/phoenix-core/src/test/java/org/apache/phoenix/schema/MappingTableDataTypeTest.java
@@ -34,7 +34,6 @@ import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.HBaseConfiguration;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
-import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.client.Put;
@@ -77,10 +76,10 @@ public class MappingTableDataTypeTest extends BaseTest{
 
   @Test
   public void testMappingHbaseTableToPhoenixTable() throws Exception {
-final TableName tableName = TableName.valueOf(MTEST);
+final byte[] tableName = Bytes.toBytes(MTEST);
 // Create table then get the single region for our new table.
-HTable t = UTIL.createTable(tableName.getName(), Bytes.toBytes(cf));
-insertData(tableName.getName(), admin, t);
+HTable t = UTIL.createTable(tableName, Bytes.toBytes(cf));
+insertData(tableName, admin, t);
 t.close();
 try {
   testCreateTableMismatchedType();



git commit: PHOENIX-1353: CsvBulkLoad doesn't work in secure env

2014-10-16 Thread jeffreyz
Repository: phoenix
Updated Branches:
  refs/heads/4.0 6333e70af - 4cd5826e7


PHOENIX-1353: CsvBulkLoad doesn't work in secure env


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

Branch: refs/heads/4.0
Commit: 4cd5826e7caf8e6db317f55ea974b077f29a3ece
Parents: 6333e70
Author: Jeffrey Zhong jeffr...@apache.org
Authored: Thu Oct 16 14:13:14 2014 -0700
Committer: Jeffrey Zhong jeffr...@apache.org
Committed: Thu Oct 16 14:16:28 2014 -0700

--
 .../end2end/ConnectionQueryServicesTestImpl.java|  2 +-
 .../java/org/apache/phoenix/jdbc/PhoenixDriver.java |  2 +-
 .../org/apache/phoenix/mapreduce/CsvBulkLoadTool.java   |  6 +-
 .../apache/phoenix/mapreduce/CsvToKeyValueMapper.java   | 12 +++-
 .../phoenix/query/ConnectionQueryServicesImpl.java  |  9 -
 5 files changed, 26 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/4cd5826e/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 2020a43..bee8d21 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
@@ -36,7 +36,7 @@ public class ConnectionQueryServicesTestImpl extends 
ConnectionQueryServicesImpl
 protected int NUM_SLAVES_BASE = 1; // number of slaves for the cluster
 
 public ConnectionQueryServicesTestImpl(QueryServices services, 
ConnectionInfo info) throws SQLException {
-super(services, info);
+super(services, info, null);
 }
 
 @Override

http://git-wip-us.apache.org/repos/asf/phoenix/blob/4cd5826e/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDriver.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDriver.java 
b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDriver.java
index 10b15dc..6360d06 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDriver.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDriver.java
@@ -149,7 +149,7 @@ public final class PhoenixDriver extends 
PhoenixEmbeddedDriver {
 if (normalizedConnInfo.isConnectionless()) {
 connectionQueryServices = new 
ConnectionlessQueryServicesImpl(services, normalizedConnInfo);
 } else {
-connectionQueryServices = new 
ConnectionQueryServicesImpl(services, normalizedConnInfo);
+connectionQueryServices = new 
ConnectionQueryServicesImpl(services, normalizedConnInfo, info);
 }
 ConnectionQueryServices prevValue = 
connectionQueryServicesMap.putIfAbsent(normalizedConnInfo, 
connectionQueryServices);
 if (prevValue != null) {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/4cd5826e/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/CsvBulkLoadTool.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/CsvBulkLoadTool.java 
b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/CsvBulkLoadTool.java
index 661a222..880cc13 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/CsvBulkLoadTool.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/CsvBulkLoadTool.java
@@ -48,6 +48,7 @@ import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
 import org.apache.hadoop.hbase.mapreduce.HFileOutputFormat;
 import org.apache.hadoop.hbase.mapreduce.LoadIncrementalHFiles;
+import org.apache.hadoop.hbase.mapreduce.TableMapReduceUtil;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.mapreduce.Job;
 import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
@@ -424,7 +425,10 @@ public class CsvBulkLoadTool extends Configured implements 
Tool {
job.setMapperClass(CsvToKeyValueMapper.class);
job.setMapOutputKeyClass(ImmutableBytesWritable.class);
job.setMapOutputValueClass(KeyValue.class);
-   
+
+   // initialize credentials to possibily run in a secure env
+   TableMapReduceUtil.initCredentials(job);
+   
 

git commit: PHOENIX-1310: Spill files filling up /tmp on server(Siddharth Wagle)

2014-10-03 Thread jeffreyz
Repository: phoenix
Updated Branches:
  refs/heads/master a55c03cc9 - 051e40843


PHOENIX-1310: Spill files filling up /tmp on server(Siddharth Wagle)


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

Branch: refs/heads/master
Commit: 051e40843bb2c8154d31f54ef17ae66cd2824d4f
Parents: a55c03c
Author: Jeffrey Zhong jeffr...@apache.org
Authored: Fri Oct 3 17:18:01 2014 -0700
Committer: Jeffrey Zhong jeffr...@apache.org
Committed: Fri Oct 3 17:18:01 2014 -0700

--
 .../phoenix/cache/aggcache/SpillFile.java   | 42 +++-
 .../phoenix/cache/aggcache/SpillManager.java|  6 ++-
 2 files changed, 28 insertions(+), 20 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/051e4084/phoenix-core/src/main/java/org/apache/phoenix/cache/aggcache/SpillFile.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/cache/aggcache/SpillFile.java 
b/phoenix-core/src/main/java/org/apache/phoenix/cache/aggcache/SpillFile.java
index 8dd64d0..51aef98 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/cache/aggcache/SpillFile.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/cache/aggcache/SpillFile.java
@@ -18,6 +18,12 @@
 
 package org.apache.phoenix.cache.aggcache;
 
+import com.google.common.collect.Maps;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.phoenix.util.Closeables;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import java.io.Closeable;
 import java.io.File;
 import java.io.IOException;
@@ -28,12 +34,6 @@ import java.nio.channels.FileChannel.MapMode;
 import java.util.Map;
 import java.util.UUID;
 
-import org.apache.phoenix.util.Closeables;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.collect.Maps;
-
 /**
  * This class abstracts a SpillFile It is a accessible on a per page basis
  * For every SpillFile object a single spill file is always created. 
@@ -49,6 +49,8 @@ public class SpillFile implements Closeable {
 static final int DEFAULT_PAGE_SIZE = 4096;
 // Map of initial SpillFile at index 0, and overflow spillFiles
 private MapInteger, TempFile tempFiles;
+// Custom spill files directory
+private File spillFilesDirectory = null;
 
 // Wrapper class for a TempFile: File + RandomAccessFile
 private static class TempFile implements Closeable{
@@ -81,22 +83,31 @@ public class SpillFile implements Closeable {
 }
}
 }
-
+
+private SpillFile(File spillFilesDirectory) throws IOException {
+  this.spillFilesDirectory = spillFilesDirectory;
+  this.tempFiles = Maps.newHashMap();
+  // Init the first pre-allocated spillFile
+  tempFiles.put(0, createTempFile());
+}
+
 /**
  * Create a new SpillFile using the Java TempFile creation function. 
SpillFile is access in
  * pages.
  */
-public static SpillFile createSpillFile() {
-   try {   
-   return new SpillFile(createTempFile()); 
+public static SpillFile createSpillFile(File spillFilesDir) {
+   try {
+   return new SpillFile(spillFilesDir);
} catch (IOException ioe) {
throw new RuntimeException(Could not create Spillfile  + ioe);
 }
 }
 
 
-private static TempFile createTempFile() throws IOException {
-File tempFile = File.createTempFile(UUID.randomUUID().toString(), 
null);
+private TempFile createTempFile() throws IOException {
+// Create temp file in temp dir or custom dir if provided
+File tempFile = File.createTempFile(UUID.randomUUID().toString(),
+  null, spillFilesDirectory);
 if (logger.isDebugEnabled()) {
 logger.debug(Creating new SpillFile:  + 
tempFile.getAbsolutePath());
 }
@@ -106,13 +117,6 @@ public class SpillFile implements Closeable {
 return new TempFile(tempFile, file);
 }
 
-
-private SpillFile(TempFile spFile) throws IOException {
-this.tempFiles = Maps.newHashMap();
-// Init the first pre-allocated spillFile
-tempFiles.put(0, spFile);
-}
-
 /**
  * Random access to a page of the current spill file
  * @param index

http://git-wip-us.apache.org/repos/asf/phoenix/blob/051e4084/phoenix-core/src/main/java/org/apache/phoenix/cache/aggcache/SpillManager.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/cache/aggcache/SpillManager.java
 

git commit: PHOENIX-1310: Spill files filling up /tmp on server(Siddharth Wagle)

2014-10-03 Thread jeffreyz
Repository: phoenix
Updated Branches:
  refs/heads/3.0 ff47a9594 - d3e6a9fa2


PHOENIX-1310: Spill files filling up /tmp on server(Siddharth Wagle)


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

Branch: refs/heads/3.0
Commit: d3e6a9fa2e6c660ffd0eca9f99eae391070bb6c3
Parents: ff47a95
Author: Jeffrey Zhong jeffr...@apache.org
Authored: Fri Oct 3 17:18:01 2014 -0700
Committer: Jeffrey Zhong jeffr...@apache.org
Committed: Fri Oct 3 17:40:12 2014 -0700

--
 .../phoenix/cache/aggcache/SpillFile.java   | 42 +++-
 .../phoenix/cache/aggcache/SpillManager.java|  6 ++-
 2 files changed, 28 insertions(+), 20 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/d3e6a9fa/phoenix-core/src/main/java/org/apache/phoenix/cache/aggcache/SpillFile.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/cache/aggcache/SpillFile.java 
b/phoenix-core/src/main/java/org/apache/phoenix/cache/aggcache/SpillFile.java
index 8dd64d0..51aef98 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/cache/aggcache/SpillFile.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/cache/aggcache/SpillFile.java
@@ -18,6 +18,12 @@
 
 package org.apache.phoenix.cache.aggcache;
 
+import com.google.common.collect.Maps;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.phoenix.util.Closeables;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import java.io.Closeable;
 import java.io.File;
 import java.io.IOException;
@@ -28,12 +34,6 @@ import java.nio.channels.FileChannel.MapMode;
 import java.util.Map;
 import java.util.UUID;
 
-import org.apache.phoenix.util.Closeables;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.collect.Maps;
-
 /**
  * This class abstracts a SpillFile It is a accessible on a per page basis
  * For every SpillFile object a single spill file is always created. 
@@ -49,6 +49,8 @@ public class SpillFile implements Closeable {
 static final int DEFAULT_PAGE_SIZE = 4096;
 // Map of initial SpillFile at index 0, and overflow spillFiles
 private MapInteger, TempFile tempFiles;
+// Custom spill files directory
+private File spillFilesDirectory = null;
 
 // Wrapper class for a TempFile: File + RandomAccessFile
 private static class TempFile implements Closeable{
@@ -81,22 +83,31 @@ public class SpillFile implements Closeable {
 }
}
 }
-
+
+private SpillFile(File spillFilesDirectory) throws IOException {
+  this.spillFilesDirectory = spillFilesDirectory;
+  this.tempFiles = Maps.newHashMap();
+  // Init the first pre-allocated spillFile
+  tempFiles.put(0, createTempFile());
+}
+
 /**
  * Create a new SpillFile using the Java TempFile creation function. 
SpillFile is access in
  * pages.
  */
-public static SpillFile createSpillFile() {
-   try {   
-   return new SpillFile(createTempFile()); 
+public static SpillFile createSpillFile(File spillFilesDir) {
+   try {
+   return new SpillFile(spillFilesDir);
} catch (IOException ioe) {
throw new RuntimeException(Could not create Spillfile  + ioe);
 }
 }
 
 
-private static TempFile createTempFile() throws IOException {
-File tempFile = File.createTempFile(UUID.randomUUID().toString(), 
null);
+private TempFile createTempFile() throws IOException {
+// Create temp file in temp dir or custom dir if provided
+File tempFile = File.createTempFile(UUID.randomUUID().toString(),
+  null, spillFilesDirectory);
 if (logger.isDebugEnabled()) {
 logger.debug(Creating new SpillFile:  + 
tempFile.getAbsolutePath());
 }
@@ -106,13 +117,6 @@ public class SpillFile implements Closeable {
 return new TempFile(tempFile, file);
 }
 
-
-private SpillFile(TempFile spFile) throws IOException {
-this.tempFiles = Maps.newHashMap();
-// Init the first pre-allocated spillFile
-tempFiles.put(0, spFile);
-}
-
 /**
  * Random access to a page of the current spill file
  * @param index

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d3e6a9fa/phoenix-core/src/main/java/org/apache/phoenix/cache/aggcache/SpillManager.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/cache/aggcache/SpillManager.java
 

git commit: PHOENIX-1173: MutableIndexFailureIT.java doesn't finish sometimes or is flappy.

2014-08-15 Thread jeffreyz
Repository: phoenix
Updated Branches:
  refs/heads/3.0 19dc23aa5 - 71cc23c8f


PHOENIX-1173: MutableIndexFailureIT.java doesn't finish sometimes or is flappy.


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

Branch: refs/heads/3.0
Commit: 71cc23c8fa03694db1816cf8e3f5d0bb3f391ccb
Parents: 19dc23a
Author: Jeffrey Zhong jeffr...@apache.org
Authored: Fri Aug 15 14:02:51 2014 -0700
Committer: Jeffrey Zhong jeffr...@apache.org
Committed: Fri Aug 15 14:02:51 2014 -0700

--
 .../apache/phoenix/coprocessor/MetaDataEndpointImpl.java| 2 ++
 .../apache/phoenix/coprocessor/MetaDataRegionObserver.java  | 9 ++---
 2 files changed, 8 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/71cc23c8/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
index 07d4cc8..9cb3b89 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
@@ -1207,6 +1207,8 @@ public class MetaDataEndpointImpl extends 
BaseEndpointCoprocessor implements Met
 dataTableKey = SchemaUtil.getTableKey(tenantId, 
schemaName, dataTableKV.getValue());
 }
 if(dataTableKey != null) {
+// make a copy of tableMetadata
+tableMetadata = new ArrayListMutation(tableMetadata);
 // insert an empty KV to trigger time stamp update on 
data table row
 Put p = new Put(dataTableKey);
 p.add(TABLE_FAMILY_BYTES, 
QueryConstants.EMPTY_COLUMN_BYTES, timeStamp, ByteUtil.EMPTY_BYTE_ARRAY);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/71cc23c8/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 2820e59..1526a98 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
@@ -24,6 +24,9 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Timer;
 import java.util.TimerTask;
+import java.util.concurrent.ScheduledFuture;
+import java.util.concurrent.ScheduledThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.commons.logging.Log;
@@ -64,14 +67,14 @@ import org.apache.phoenix.util.SchemaUtil;
  */
 public class MetaDataRegionObserver extends BaseRegionObserver {
 public static final Log LOG = 
LogFactory.getLog(MetaDataRegionObserver.class);
-protected Timer scheduleTimer = new Timer(true);
+protected ScheduledThreadPoolExecutor executor = new 
ScheduledThreadPoolExecutor(1);
 private boolean enableRebuildIndex = 
QueryServicesOptions.DEFAULT_INDEX_FAILURE_HANDLING_REBUILD;
 private long rebuildIndexTimeInterval = 
QueryServicesOptions.DEFAULT_INDEX_FAILURE_HANDLING_REBUILD_INTERVAL;
   
 @Override
 public void preClose(final ObserverContextRegionCoprocessorEnvironment c,
 boolean abortRequested) {
-scheduleTimer.cancel();
+executor.shutdownNow();
 
GlobalCache.getInstance(c.getEnvironment()).getMetaDataCache().invalidateAll();
 }
 
@@ -112,7 +115,7 @@ public class MetaDataRegionObserver extends 
BaseRegionObserver {
 // starts index rebuild schedule work
 BuildIndexScheduleTask task = new 
BuildIndexScheduleTask(e.getEnvironment());
 // run scheduled task every 10 secs
-scheduleTimer.schedule(task, 1, rebuildIndexTimeInterval);
+executor.scheduleAtFixedRate(task, 1, 
rebuildIndexTimeInterval, TimeUnit.MILLISECONDS);
 } catch (ClassNotFoundException ex) {
 LOG.error(BuildIndexScheduleTask cannot start!, ex);
 }



git commit: PHOENIX-1173: MutableIndexFailureIT.java doesn't finish sometimes or is flappy.

2014-08-15 Thread jeffreyz
Repository: phoenix
Updated Branches:
  refs/heads/master 367662dc8 - ebb6a7adb


PHOENIX-1173: MutableIndexFailureIT.java doesn't finish sometimes or is flappy.


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

Branch: refs/heads/master
Commit: ebb6a7adb9134eb2413950796bd5f4e80a250e7d
Parents: 367662d
Author: Jeffrey Zhong jeffr...@apache.org
Authored: Fri Aug 15 14:02:51 2014 -0700
Committer: Jeffrey Zhong jeffr...@apache.org
Committed: Fri Aug 15 16:05:55 2014 -0700

--
 .../apache/phoenix/coprocessor/MetaDataEndpointImpl.java| 2 ++
 .../apache/phoenix/coprocessor/MetaDataRegionObserver.java  | 9 ++---
 2 files changed, 8 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/ebb6a7ad/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
index b99483b..5b43a90 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
@@ -1508,6 +1508,8 @@ public class MetaDataEndpointImpl extends 
MetaDataProtocol implements Coprocesso
 dataTableKey = SchemaUtil.getTableKey(tenantId, 
schemaName, dataTableKV.getValue());
 }
 if(dataTableKey != null) {
+// make a copy of tableMetadata
+tableMetadata = new ArrayListMutation(tableMetadata);
 // insert an empty KV to trigger time stamp update on 
data table row
 Put p = new Put(dataTableKey);
 p.add(TABLE_FAMILY_BYTES, 
QueryConstants.EMPTY_COLUMN_BYTES, timeStamp, ByteUtil.EMPTY_BYTE_ARRAY);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/ebb6a7ad/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 6ce0148..822ced8 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
@@ -28,6 +28,9 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Timer;
 import java.util.TimerTask;
+import java.util.concurrent.ScheduledFuture;
+import java.util.concurrent.ScheduledThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.commons.logging.Log;
@@ -65,14 +68,14 @@ import org.apache.phoenix.util.SchemaUtil;
  */
 public class MetaDataRegionObserver extends BaseRegionObserver {
 public static final Log LOG = 
LogFactory.getLog(MetaDataRegionObserver.class);
-protected Timer scheduleTimer = new Timer(true);
+protected ScheduledThreadPoolExecutor executor = new 
ScheduledThreadPoolExecutor(1);
 private boolean enableRebuildIndex = 
QueryServicesOptions.DEFAULT_INDEX_FAILURE_HANDLING_REBUILD;
 private long rebuildIndexTimeInterval = 
QueryServicesOptions.DEFAULT_INDEX_FAILURE_HANDLING_REBUILD_INTERVAL;
   
 @Override
 public void preClose(final ObserverContextRegionCoprocessorEnvironment c,
 boolean abortRequested) {
-scheduleTimer.cancel();
+executor.shutdownNow();
 
GlobalCache.getInstance(c.getEnvironment()).getMetaDataCache().invalidateAll();
 }
 
@@ -113,7 +116,7 @@ public class MetaDataRegionObserver extends 
BaseRegionObserver {
 // starts index rebuild schedule work
 BuildIndexScheduleTask task = new 
BuildIndexScheduleTask(e.getEnvironment());
 // run scheduled task every 10 secs
-scheduleTimer.schedule(task, 1, rebuildIndexTimeInterval);
+executor.scheduleAtFixedRate(task, 1, 
rebuildIndexTimeInterval, TimeUnit.MILLISECONDS);
 } catch (ClassNotFoundException ex) {
 LOG.error(BuildIndexScheduleTask cannot start!, ex);
 }



git commit: Phoenix-1147: Ensure data table is sent to client if index table changes states - Addendum to handle schema name

2014-08-08 Thread jeffreyz
Repository: phoenix
Updated Branches:
  refs/heads/master 01542165b - bf26ef233


Phoenix-1147: Ensure data table is sent to client if index table changes states 
- Addendum to handle schema name


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

Branch: refs/heads/master
Commit: bf26ef23370ed4bf455bd09215a24b48f5324196
Parents: 0154216
Author: Jeffrey Zhong jeffr...@apache.org
Authored: Fri Aug 8 16:52:00 2014 -0700
Committer: Jeffrey Zhong jeffr...@apache.org
Committed: Fri Aug 8 16:58:00 2014 -0700

--
 .../phoenix/end2end/index/MutableIndexFailureIT.java| 12 +++-
 .../phoenix/coprocessor/MetaDataRegionObserver.java |  8 ++--
 2 files changed, 13 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/bf26ef23/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 103c81b..e499c3b 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
@@ -109,7 +109,7 @@ public class MutableIndexFailureIT extends BaseTest {
 private static HBaseTestingUtility util;
 private Timer scheduleTimer;
 
-private static final String SCHEMA_NAME = ;
+private static final String SCHEMA_NAME = S;
 private static final String INDEX_TABLE_NAME = I;
 private static final String DATA_TABLE_FULL_NAME = 
SchemaUtil.getTableName(SCHEMA_NAME, T);
 private static final String INDEX_TABLE_FULL_NAME = 
SchemaUtil.getTableName(SCHEMA_NAME, I);
@@ -178,7 +178,7 @@ public class MutableIndexFailureIT extends BaseTest {
 stmt.execute();
 conn.commit();
 
-TableName indexTable = TableName.valueOf(INDEX_TABLE_NAME);
+TableName indexTable = TableName.valueOf(INDEX_TABLE_FULL_NAME);
 HBaseAdmin admin = this.util.getHBaseAdmin();
 HTableDescriptor indexTableDesc = admin.getTableDescriptor(indexTable);
 try{
@@ -221,7 +221,8 @@ public class MutableIndexFailureIT extends BaseTest {
 admin.createTable(indexTableDesc);
 do {
   Thread.sleep(15 * 1000); // sleep 15 secs
-  rs = conn.getMetaData().getTables(null, , INDEX_TABLE_NAME, new 
String[] {PTableType.INDEX.toString()});
+  rs = conn.getMetaData().getTables(null, 
StringUtil.escapeLike(SCHEMA_NAME), INDEX_TABLE_NAME,
+  new String[] { PTableType.INDEX.toString() });
   assertTrue(rs.next());
   
if(PIndexState.ACTIVE.toString().equals(rs.getString(INDEX_STATE))){
   break;
@@ -275,7 +276,7 @@ public class MutableIndexFailureIT extends BaseTest {
 
 // find a RS which doesn't has CATALOG table
 TableName catalogTable = TableName.valueOf(SYSTEM.CATALOG);
-TableName indexTable = TableName.valueOf(INDEX_TABLE_NAME);
+TableName indexTable = TableName.valueOf(INDEX_TABLE_FULL_NAME);
 final HBaseCluster cluster = this.util.getHBaseCluster();
 CollectionServerName rss = cluster.getClusterStatus().getServers();
 HBaseAdmin admin = this.util.getHBaseAdmin();
@@ -320,7 +321,8 @@ public class MutableIndexFailureIT extends BaseTest {
 // Verify the metadata for index is correct.   
 do {
   Thread.sleep(15 * 1000); // sleep 15 secs
-  rs = conn.getMetaData().getTables(null, , INDEX_TABLE_NAME, new 
String[] {PTableType.INDEX.toString()});
+  rs = conn.getMetaData().getTables(null, 
StringUtil.escapeLike(SCHEMA_NAME), INDEX_TABLE_NAME,
+  new String[] { PTableType.INDEX.toString() });
   assertTrue(rs.next());
   
if(PIndexState.ACTIVE.toString().equals(rs.getString(INDEX_STATE))){
   break;

http://git-wip-us.apache.org/repos/asf/phoenix/blob/bf26ef23/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 3a72c5d..6ce0148 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataRegionObserver.java
+++ 

git commit: Phoenix-950: Improve Secondary Index Update Failure Handling - addendum

2014-07-30 Thread jeffreyz
Repository: phoenix
Updated Branches:
  refs/heads/master 3d69fa211 - a8113ac0d


Phoenix-950: Improve Secondary Index Update Failure Handling - addendum


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

Branch: refs/heads/master
Commit: a8113ac0def2ef7d76af35afab509dc6ce6b624d
Parents: 3d69fa2
Author: Jeffrey Zhong jeffr...@apache.org
Authored: Wed Jul 30 16:00:32 2014 -0700
Committer: Jeffrey Zhong jeffr...@apache.org
Committed: Wed Jul 30 16:00:32 2014 -0700

--
 pom.xml | 5 +
 1 file changed, 5 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/a8113ac0/pom.xml
--
diff --git a/pom.xml b/pom.xml
index 4612d70..f8843af 100644
--- a/pom.xml
+++ b/pom.xml
@@ -695,6 +695,11 @@
   /dependency
   dependency
 groupIdorg.apache.hbase/groupId
+artifactIdhbase-common/artifactId
+version${hbase-hadoop2.version}/version
+  /dependency
+  dependency
+groupIdorg.apache.hbase/groupId
 artifactIdhbase-client/artifactId
 version${hbase-hadoop2.version}/version
   /dependency



git commit: Phoenix-950: Improve Secondary Index Update Failure Handling - addendum

2014-07-30 Thread jeffreyz
Repository: phoenix
Updated Branches:
  refs/heads/4.0 b39e678a4 - 00216d46c


Phoenix-950: Improve Secondary Index Update Failure Handling - addendum


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

Branch: refs/heads/4.0
Commit: 00216d46c189b8cf8b2e33607da196276e613ed6
Parents: b39e678
Author: Jeffrey Zhong jeffr...@apache.org
Authored: Wed Jul 30 16:00:32 2014 -0700
Committer: Jeffrey Zhong jeffr...@apache.org
Committed: Wed Jul 30 16:02:00 2014 -0700

--
 pom.xml | 5 +
 1 file changed, 5 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/00216d46/pom.xml
--
diff --git a/pom.xml b/pom.xml
index 1cd3b48..cacf5a0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -695,6 +695,11 @@
   /dependency
   dependency
 groupIdorg.apache.hbase/groupId
+artifactIdhbase-common/artifactId
+version${hbase-hadoop2.version}/version
+  /dependency
+  dependency
+groupIdorg.apache.hbase/groupId
 artifactIdhbase-client/artifactId
 version${hbase-hadoop2.version}/version
   /dependency



git commit: PHOENIX-1072: Fast fail sqlline.py when pass wrong quorum string or hbase cluster hasnt' started yet

2014-07-16 Thread jeffreyz
Repository: phoenix
Updated Branches:
  refs/heads/master 4e19c8cfb - a41dc5254


PHOENIX-1072: Fast fail sqlline.py when pass wrong quorum string or hbase 
cluster hasnt' started yet


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

Branch: refs/heads/master
Commit: a41dc5254aaf90796e208b1a4bd8d14b2c61b018
Parents: 4e19c8c
Author: Jeffrey Zhong jeffr...@apache.org
Authored: Wed Jul 16 17:27:14 2014 -0700
Committer: Jeffrey Zhong jeffr...@apache.org
Committed: Wed Jul 16 17:27:14 2014 -0700

--
 bin/log4j.properties |  4 +++-
 bin/sqlline.py   | 14 +-
 2 files changed, 16 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/a41dc525/bin/log4j.properties
--
diff --git a/bin/log4j.properties b/bin/log4j.properties
index 30119bc..47d45e8 100644
--- a/bin/log4j.properties
+++ b/bin/log4j.properties
@@ -65,5 +65,7 @@ log4j.appender.console.layout=org.apache.log4j.PatternLayout
 log4j.appender.console.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss} %p 
%c{2}: %m%n
 
 # Custom Logging levels
-log4j.logger.org.apache.zookeeper=WARN
+log4j.logger.org.apache.zookeeper=ERROR
+log4j.logger.org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper=ERROR
+log4j.logger.org.apache.hadoop.hbase.zookeeper.ZKUtil=ERROR
 log4j.logger.org.apache.hadoop.hbase.HBaseConfiguration=ERROR

http://git-wip-us.apache.org/repos/asf/phoenix/blob/a41dc525/bin/sqlline.py
--
diff --git a/bin/sqlline.py b/bin/sqlline.py
index 00fccdb..d42be07 100755
--- a/bin/sqlline.py
+++ b/bin/sqlline.py
@@ -23,6 +23,15 @@ import os
 import subprocess
 import sys
 import phoenix_utils
+import atexit
+
+global childProc
+childProc = None
+def kill_child():
+if childProc is not None:
+childProc.terminate()
+childProc.kill()
+atexit.register(kill_child)
 
 phoenix_utils.setPath()
 
@@ -50,4 +59,7 @@ java_cmd = 'java -cp .' + os.pathsep + 
phoenix_utils.phoenix_client_jar + \
  -n none -p none --color= + colorSetting +  --fastConnect=false 
--verbose=true \
 --isolation=TRANSACTION_READ_COMMITTED  + sqlfile
 
-subprocess.call(java_cmd, shell=True)
+childProc = subprocess.Popen(java_cmd, shell=True)
+#Wait for child process exit
+(output, error) = childProc.communicate()
+childProc = None



git commit: PHOENIX-1072: Fast fail sqlline.py when pass wrong quorum string or hbase cluster hasnt' started yet

2014-07-09 Thread jeffreyz
Repository: phoenix
Updated Branches:
  refs/heads/master 9bb0b01f6 - 013e96c02


PHOENIX-1072: Fast fail sqlline.py when pass wrong quorum string or hbase 
cluster hasnt' started yet


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

Branch: refs/heads/master
Commit: 013e96c02b50f767e8e1e17d37c4cceef018d3eb
Parents: 9bb0b01
Author: Jeffrey Zhong jeffr...@apache.org
Authored: Wed Jul 9 17:43:54 2014 -0700
Committer: Jeffrey Zhong jeffr...@apache.org
Committed: Wed Jul 9 17:43:54 2014 -0700

--
 bin/log4j.properties  | 4 +++-
 .../org/apache/phoenix/query/ConnectionQueryServicesImpl.java | 7 +++
 2 files changed, 10 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/013e96c0/bin/log4j.properties
--
diff --git a/bin/log4j.properties b/bin/log4j.properties
index 30119bc..47d45e8 100644
--- a/bin/log4j.properties
+++ b/bin/log4j.properties
@@ -65,5 +65,7 @@ log4j.appender.console.layout=org.apache.log4j.PatternLayout
 log4j.appender.console.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss} %p 
%c{2}: %m%n
 
 # Custom Logging levels
-log4j.logger.org.apache.zookeeper=WARN
+log4j.logger.org.apache.zookeeper=ERROR
+log4j.logger.org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper=ERROR
+log4j.logger.org.apache.hadoop.hbase.zookeeper.ZKUtil=ERROR
 log4j.logger.org.apache.hadoop.hbase.HBaseConfiguration=ERROR

http://git-wip-us.apache.org/repos/asf/phoenix/blob/013e96c0/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 5eb5314..04e65e7 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
@@ -1457,6 +1457,8 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 
 SQLException sqlE = null;
 PhoenixConnection metaConnection = null;
+int origClientRetries = 
ConnectionQueryServicesImpl.this.config.getInt(
+HConstants.HBASE_CLIENT_RETRIES_NUMBER, 
HConstants.DEFAULT_HBASE_CLIENT_RETRIES_NUMBER);
 try {
 openConnection();
 Properties scnProps = 
PropertiesUtil.deepCopy(props);
@@ -1464,6 +1466,9 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 PhoenixRuntime.CURRENT_SCN_ATTRIB,
 
Long.toString(MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP));
 scnProps.remove(PhoenixRuntime.TENANT_ID_ATTRIB);
+// during initialization fast fail when connection 
has issues
+ConnectionQueryServicesImpl.this.config.setInt(
+HConstants.HBASE_CLIENT_RETRIES_NUMBER, 
Math.min(2,origClientRetries));
 metaConnection = new PhoenixConnection(
 ConnectionQueryServicesImpl.this, url, 
scnProps, newEmptyMetaData());
 try {
@@ -1482,6 +1487,8 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 } catch (SQLException e) {
 sqlE = e;
 } finally {
+ConnectionQueryServicesImpl.this.config.setInt(
+HConstants.HBASE_CLIENT_RETRIES_NUMBER, 
origClientRetries);
 try {
 if (metaConnection != null) 
metaConnection.close();
 } catch (SQLException e) {



git commit: PHOENIX-1072: Fast fail sqlline.py when pass wrong quorum string or hbase cluster hasnt' started yet

2014-07-09 Thread jeffreyz
Repository: phoenix
Updated Branches:
  refs/heads/4.0 8dfda14ae - 46b445bef


PHOENIX-1072: Fast fail sqlline.py when pass wrong quorum string or hbase 
cluster hasnt' started yet


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

Branch: refs/heads/4.0
Commit: 46b445befb43e6257bb085c01a0a26e30ee68366
Parents: 8dfda14
Author: Jeffrey Zhong jeffr...@apache.org
Authored: Wed Jul 9 17:43:54 2014 -0700
Committer: Jeffrey Zhong jeffr...@apache.org
Committed: Wed Jul 9 17:49:05 2014 -0700

--
 bin/log4j.properties  | 4 +++-
 .../org/apache/phoenix/query/ConnectionQueryServicesImpl.java | 7 +++
 2 files changed, 10 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/46b445be/bin/log4j.properties
--
diff --git a/bin/log4j.properties b/bin/log4j.properties
index 30119bc..47d45e8 100644
--- a/bin/log4j.properties
+++ b/bin/log4j.properties
@@ -65,5 +65,7 @@ log4j.appender.console.layout=org.apache.log4j.PatternLayout
 log4j.appender.console.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss} %p 
%c{2}: %m%n
 
 # Custom Logging levels
-log4j.logger.org.apache.zookeeper=WARN
+log4j.logger.org.apache.zookeeper=ERROR
+log4j.logger.org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper=ERROR
+log4j.logger.org.apache.hadoop.hbase.zookeeper.ZKUtil=ERROR
 log4j.logger.org.apache.hadoop.hbase.HBaseConfiguration=ERROR

http://git-wip-us.apache.org/repos/asf/phoenix/blob/46b445be/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 a83a0c9..be0ac7a 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
@@ -1457,6 +1457,8 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 
 SQLException sqlE = null;
 PhoenixConnection metaConnection = null;
+int origClientRetries = 
ConnectionQueryServicesImpl.this.config.getInt(
+HConstants.HBASE_CLIENT_RETRIES_NUMBER, 
HConstants.DEFAULT_HBASE_CLIENT_RETRIES_NUMBER);
 try {
 openConnection();
 Properties scnProps = 
PropertiesUtil.deepCopy(props);
@@ -1464,6 +1466,9 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 PhoenixRuntime.CURRENT_SCN_ATTRIB,
 
Long.toString(MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP));
 scnProps.remove(PhoenixRuntime.TENANT_ID_ATTRIB);
+// during initialization fast fail when connection 
has issues
+ConnectionQueryServicesImpl.this.config.setInt(
+HConstants.HBASE_CLIENT_RETRIES_NUMBER, 
Math.min(2,origClientRetries));
 metaConnection = new PhoenixConnection(
 ConnectionQueryServicesImpl.this, url, 
scnProps, newEmptyMetaData());
 try {
@@ -1482,6 +1487,8 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 } catch (SQLException e) {
 sqlE = e;
 } finally {
+ConnectionQueryServicesImpl.this.config.setInt(
+HConstants.HBASE_CLIENT_RETRIES_NUMBER, 
origClientRetries);
 try {
 if (metaConnection != null) 
metaConnection.close();
 } catch (SQLException e) {