[30/50] [abbrv] phoenix git commit: PHOENIX-1071 - Lowering memory usage for Spark integration tests to see if build passes

2015-04-16 Thread maryannxue
PHOENIX-1071 - Lowering memory usage for Spark integration tests to see if 
build passes


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

Branch: refs/heads/calcite
Commit: 5c32d1955f7289d38813424163f3b472ae0fe304
Parents: ff0e8e4
Author: Mujtaba 
Authored: Tue Apr 7 16:58:12 2015 -0700
Committer: Mujtaba 
Committed: Tue Apr 7 16:58:12 2015 -0700

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


http://git-wip-us.apache.org/repos/asf/phoenix/blob/5c32d195/phoenix-spark/pom.xml
--
diff --git a/phoenix-spark/pom.xml b/phoenix-spark/pom.xml
index fd0ccaf..412f59a 100644
--- a/phoenix-spark/pom.xml
+++ b/phoenix-spark/pom.xml
@@ -502,7 +502,7 @@
 
   true
   Integration-Test
-  -Xmx3g -XX:MaxPermSize=512m 
-XX:ReservedCodeCacheSize=512m
+  -Xmx2g -XX:MaxPermSize=512m 
-XX:ReservedCodeCacheSize=512m
 
   
   



[15/50] [abbrv] phoenix git commit: PHOENIX-1748 Applying TRUNC|ROUND|FLOOR|CEIL on TIMESTAMP should maintain return type of TIMESTAMP (Dave Hacker)

2015-04-16 Thread maryannxue
PHOENIX-1748 Applying TRUNC|ROUND|FLOOR|CEIL on TIMESTAMP should maintain 
return type of TIMESTAMP (Dave Hacker)


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

Branch: refs/heads/calcite
Commit: f766a780c2941ec30911989de5c28852ebfeb9bf
Parents: 1e28061
Author: Thomas D'Silva 
Authored: Thu Apr 2 11:51:04 2015 -0700
Committer: Thomas D'Silva 
Committed: Thu Apr 2 11:51:04 2015 -0700

--
 .../RoundFloorCeilFunctionsEnd2EndIT.java   | 114 +++
 1 file changed, 114 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/f766a780/phoenix-core/src/it/java/org/apache/phoenix/end2end/RoundFloorCeilFunctionsEnd2EndIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/RoundFloorCeilFunctionsEnd2EndIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/RoundFloorCeilFunctionsEnd2EndIT.java
index 2cf08e9..42635c6 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/RoundFloorCeilFunctionsEnd2EndIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/RoundFloorCeilFunctionsEnd2EndIT.java
@@ -29,10 +29,12 @@ import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.Time;
 import java.sql.Timestamp;
+import java.util.Properties;
 
 import org.apache.phoenix.expression.function.CeilFunction;
 import org.apache.phoenix.expression.function.FloorFunction;
 import org.apache.phoenix.expression.function.RoundFunction;
+import org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.util.DateUtil;
 import org.junit.Before;
 import org.junit.Test;
@@ -439,5 +441,117 @@ public class RoundFloorCeilFunctionsEnd2EndIT extends 
BaseHBaseManagedTimeIT {
assertEquals(0, Floats.compare(1.26f, rs.getFloat(3)));
assertEquals(0, Floats.compare(1.264f, rs.getFloat(4)));
}   
+   
+   @Test
+   public void testTimestampAggregateFunctions() throws Exception {
+   String dateString = "2015-03-08 09:09:11.665";
+   Properties props = new Properties();
+   props.setProperty(QueryServices.DATE_FORMAT_TIMEZONE_ATTRIB, 
"GMT+1");
+   Connection conn = DriverManager.getConnection(getUrl(), props);
+   try {
+   conn.prepareStatement(
+   "create table TIME_AGG_TABLE("
+   + "ID unsigned_int NOT 
NULL, "
+   + "THE_DATE TIMESTAMP, "
+   + "constraint PK 
primary key (ID))").execute();
+   PreparedStatement stmt = conn.prepareStatement("upsert 
into "
+   + "TIME_AGG_TABLE(" + "ID, " + "
THE_DATE)"
+   + "VALUES (?, ?)");
+   stmt.setInt(1, 1);
+   stmt.setTimestamp(2, 
DateUtil.parseTimestamp(dateString));
+   stmt.execute();
+   conn.commit();
+
+   ResultSet rs = conn.prepareStatement(
+   "SELECT THE_DATE ,TRUNC(THE_DATE,'DAY') 
AS day_from_dt "
+   + 
",TRUNC(THE_DATE,'HOUR') AS hour_from_dt "
+   + 
",TRUNC(THE_DATE,'MINUTE') AS min_from_dt "
+   + 
",TRUNC(THE_DATE,'SECOND') AS sec_from_dt "
+   + 
",TRUNC(THE_DATE,'MILLISECOND') AS mil_from_dt "
+   + "FROM 
TIME_AGG_TABLE").executeQuery();
+   assertTrue(rs.next());
+   assertEquals(DateUtil.parseTimestamp("2015-03-08 
09:09:11.665"),
+   rs.getTimestamp("THE_DATE"));
+   assertEquals(DateUtil.parseTimestamp("2015-03-08 
00:00:00.0"),
+   rs.getTimestamp("day_from_dt"));
+   assertEquals(DateUtil.parseTimestamp("2015-03-08 
09:00:00.0"),
+   rs.getTimestamp("hour_from_dt"));
+   assertEquals(DateUtil.parseTimestamp("2015-03-08 
09:09:00.0"),
+   rs.getTimestamp("min_from_dt"));
+   assertEquals(DateUtil.parseTimestamp("2015-03-08 
09:09:11.0"),
+   rs.

[03/50] [abbrv] phoenix git commit: PHOENIX-1770 Correct exit code from bin scripts

2015-04-16 Thread maryannxue
PHOENIX-1770 Correct exit code from bin scripts

Make the python scripts under bin/ exit with the exit code that
was returned from the underlying java command.

Contributed by Mark Tse.


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

Branch: refs/heads/calcite
Commit: 1a13784228f05ebe51e52ad80ae464d8531c2fe0
Parents: f941e89
Author: Gabriel Reid 
Authored: Thu Mar 26 08:43:48 2015 +0100
Committer: Gabriel Reid 
Committed: Thu Mar 26 08:45:49 2015 +0100

--
 bin/end2endTest.py |  3 ++-
 bin/performance.py | 13 ++---
 bin/psql.py|  3 ++-
 3 files changed, 14 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/1a137842/bin/end2endTest.py
--
diff --git a/bin/end2endTest.py b/bin/end2endTest.py
index 96886c7..a5993dc 100755
--- a/bin/end2endTest.py
+++ b/bin/end2endTest.py
@@ -44,4 +44,5 @@ java_cmd = "java -cp " + hbase_config_path + os.pathsep + 
phoenix_jar_path + os.
 hbase_library_path + " org.apache.phoenix.end2end.End2EndTestDriver " + \
 ' '.join(sys.argv[1:])
 
-subprocess.call(java_cmd, shell=True)
+exitcode = subprocess.call(java_cmd, shell=True)
+sys.exit(exitcode)

http://git-wip-us.apache.org/repos/asf/phoenix/blob/1a137842/bin/performance.py
--
diff --git a/bin/performance.py b/bin/performance.py
index c69edfd..b9df433 100755
--- a/bin/performance.py
+++ b/bin/performance.py
@@ -85,7 +85,9 @@ print "-"
 print "\nCreating performance table..."
 createFileWithContent(ddl, createtable)
 
-subprocess.call(execute + ddl, shell=True)
+exitcode = subprocess.call(execute + ddl, shell=True)
+if exitcode != 0:
+sys.exit(exitcode)
 
 # Write real,user,sys time on console for the following queries
 queryex("1 - Count", "SELECT COUNT(1) FROM %s;" % (table))
@@ -95,11 +97,16 @@ queryex("4 - Truncate + Group By", "SELECT 
TRUNC(DATE,'DAY') DAY FROM %s GROUP B
 queryex("5 - Filter + Count", "SELECT COUNT(1) FROM %s WHERE CORE<10;" % 
(table))
 
 print "\nGenerating and upserting data..."
-subprocess.call('java -jar %s %s' % (phoenix_utils.testjar, rowcount), 
shell=True)
+exitcode = subprocess.call('java -jar %s %s' % (phoenix_utils.testjar, 
rowcount), shell=True)
+if exitcode != 0:
+sys.exit(exitcode)
+
 print "\n"
 createFileWithContent(qry, statements)
 
-subprocess.call(execute + data + ' ' + qry, shell=True)
+exitcode = subprocess.call(execute + data + ' ' + qry, shell=True)
+if exitcode != 0:
+sys.exit(exitcode)
 
 # clear temporary files
 delfile(ddl)

http://git-wip-us.apache.org/repos/asf/phoenix/blob/1a137842/bin/psql.py
--
diff --git a/bin/psql.py b/bin/psql.py
index 34a95df..247001a 100755
--- a/bin/psql.py
+++ b/bin/psql.py
@@ -39,4 +39,5 @@ java_cmd = 'java -cp "' + phoenix_utils.hbase_conf_path + 
os.pathsep + phoenix_u
 os.path.join(phoenix_utils.current_dir, "log4j.properties") + \
 " org.apache.phoenix.util.PhoenixRuntime " + args 
 
-subprocess.call(java_cmd, shell=True)
+exitcode = subprocess.call(java_cmd, shell=True)
+sys.exit(exitcode)



[50/50] [abbrv] phoenix git commit: Fix compilation errors and assertion failures

2015-04-16 Thread maryannxue
Fix compilation errors and assertion failures


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

Branch: refs/heads/calcite
Commit: 9309fff7ee1dadbfa4e9956662caaa4131561138
Parents: 2368ea6 3fb3bb4
Author: maryannxue 
Authored: Thu Apr 16 10:31:13 2015 -0400
Committer: maryannxue 
Committed: Thu Apr 16 10:31:13 2015 -0400

--
 .gitignore  |   5 +
 NOTICE  |   5 +
 bin/end2endTest.py  |   3 +-
 bin/performance.py  |  13 +-
 bin/psql.py |   3 +-
 phoenix-assembly/pom.xml|   8 +-
 phoenix-assembly/src/build/client.xml   |   4 +-
 .../src/build/components-major-client.xml   |   2 +
 .../src/build/components/all-common-files.xml   |  11 +-
 .../src/build/components/all-common-jars.xml|  11 +
 .../src/build/server-without-antlr.xml  |   2 +
 phoenix-assembly/src/build/server.xml   |   2 +
 phoenix-core/pom.xml|  11 +-
 .../wal/ReadWriteKeyValuesWithCodecIT.java  |  14 +-
 ...ReplayWithIndexWritesAndCompressedWALIT.java |  34 +-
 .../apache/phoenix/end2end/AlterSessionIT.java  |  92 +++
 .../phoenix/end2end/ArithmeticQueryIT.java  |  88 +++
 .../phoenix/end2end/ArrayAppendFunctionIT.java  | 667 +++
 .../org/apache/phoenix/end2end/ArrayIT.java |  12 +-
 .../org/apache/phoenix/end2end/BaseViewIT.java  |   1 +
 .../end2end/ClientTimeArithmeticQueryIT.java|  10 +-
 .../phoenix/end2end/CoalesceFunctionIT.java |   2 +-
 .../end2end/ConvertTimezoneFunctionIT.java  |  42 +-
 .../org/apache/phoenix/end2end/DateTimeIT.java  | 637 ++
 .../apache/phoenix/end2end/DerivedTableIT.java  |   4 +-
 .../phoenix/end2end/EncodeFunctionIT.java   |  12 +-
 .../org/apache/phoenix/end2end/HashJoinIT.java  |  10 -
 .../apache/phoenix/end2end/InstrFunctionIT.java | 126 
 .../org/apache/phoenix/end2end/KeyOnlyIT.java   |   2 +-
 .../phoenix/end2end/LikeExpressionIT.java   |  88 +++
 .../org/apache/phoenix/end2end/NotQueryIT.java  |   8 +-
 .../org/apache/phoenix/end2end/OrderByIT.java   | 396 ++-
 .../phoenix/end2end/PhoenixMetricsIT.java   | 151 +
 .../end2end/QueryDatabaseMetaDataIT.java| 217 +++---
 .../phoenix/end2end/QueryWithLimitIT.java   |   2 +-
 .../end2end/RegexpReplaceFunctionIT.java| 100 +++
 .../phoenix/end2end/RegexpSubstrFunctionIT.java |  43 +-
 .../RoundFloorCeilFunctionsEnd2EndIT.java   | 114 
 .../phoenix/end2end/RowValueConstructorIT.java  |  33 +-
 .../phoenix/end2end/SignFunctionEnd2EndIT.java  | 141 
 .../phoenix/end2end/StatsCollectorIT.java   |   1 +
 .../StatsCollectorWithSplitsAndMultiCFIT.java   |   7 +
 .../org/apache/phoenix/end2end/SubqueryIT.java  |   8 +-
 .../end2end/SubqueryUsingSortMergeJoinIT.java   |  20 +-
 .../end2end/TimezoneOffsetFunctionIT.java   |  39 +-
 .../phoenix/end2end/ToDateFunctionIT.java   |  57 ++
 .../org/apache/phoenix/end2end/UnionAllIT.java  | 648 ++
 .../phoenix/end2end/VariableLengthPKIT.java |   6 +-
 .../index/GlobalIndexOptimizationIT.java|  11 +-
 .../index/ImmutableIndexWithStatsIT.java|  89 +++
 .../end2end/index/IndexExpressionIT.java| 165 +++--
 .../phoenix/end2end/index/IndexHandlerIT.java   |  12 +-
 .../phoenix/end2end/index/LocalIndexIT.java |  32 +-
 .../end2end/index/MutableIndexFailureIT.java|   6 +-
 .../index/balancer/IndexLoadBalancerIT.java |   6 +-
 .../EndToEndCoveredColumnsIndexBuilderIT.java   |   8 +-
 .../apache/phoenix/mapreduce/IndexToolIT.java   | 296 
 .../apache/phoenix/rpc/PhoenixClientRpcIT.java  | 113 
 .../apache/phoenix/rpc/PhoenixServerRpcIT.java  | 232 +++
 .../TestPhoenixIndexRpcSchedulerFactory.java|  64 ++
 .../phoenix/trace/PhoenixTraceReaderIT.java |   2 +-
 .../phoenix/trace/PhoenixTracingEndToEndIT.java |  57 +-
 phoenix-core/src/main/antlr3/PhoenixSQL.g   | 155 ++---
 .../hbase/ipc/PhoenixIndexRpcScheduler.java | 120 
 .../hadoop/hbase/ipc/PhoenixRpcScheduler.java   | 129 
 .../hbase/ipc/PhoenixRpcSchedulerFactory.java   |  95 +++
 .../controller/ClientRpcControllerFactory.java  |  60 ++
 .../ipc/controller/IndexRpcController.java  |  51 ++
 .../ipc/controller/MetadataRpcController.java   |  55 ++
 .../controller/ServerRpcControllerFactory.java  |  62 ++
 .../regionserver/IndexHalfStoreFileReader.java  |  48 +-
 .../IndexHalfStoreFileReaderGenerator.java  |  14 +-
 .../regionserver/IndexSplitTransaction.java |  30 +-
 .../hbase/regionserver/KeyValueSkipListSet.java | 183

[32/50] [abbrv] phoenix git commit: PHOENIX-1071 Get the phoenix-spark integration tests running.

2015-04-16 Thread maryannxue
PHOENIX-1071 Get the phoenix-spark integration tests running.

Uses the BaseHBaseManagedTimeIT framework now for creating the
test cluster and setup/teardown.

Tested with Java 7u75 i386 on Ubuntu, and 7u40 x64 on OS X.


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

Branch: refs/heads/calcite
Commit: 623829dbeb13933dd6fc38821b258db87cc402a8
Parents: ca4e212
Author: Josh Mahonin 
Authored: Tue Apr 7 22:33:17 2015 -0400
Committer: ravimagham 
Committed: Thu Apr 9 01:37:31 2015 -0700

--
 phoenix-spark/pom.xml   |  20 +-
 phoenix-spark/src/it/resources/log4j.xml|   8 +
 .../apache/phoenix/spark/PhoenixRDDTest.scala   | 333 ---
 .../apache/phoenix/spark/PhoenixSparkIT.scala   | 326 ++
 4 files changed, 347 insertions(+), 340 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/623829db/phoenix-spark/pom.xml
--
diff --git a/phoenix-spark/pom.xml b/phoenix-spark/pom.xml
index 412f59a..abed37e 100644
--- a/phoenix-spark/pom.xml
+++ b/phoenix-spark/pom.xml
@@ -22,7 +22,12 @@
   org.apache.phoenix
   phoenix-core
 
-
+
+  org.apache.phoenix
+  phoenix-core
+  tests
+  test
+
 
 
   javax.servlet
@@ -46,7 +51,7 @@
 
   org.scalatest
   scalatest_${scala.binary.version}
-  2.2.2
+  2.2.4
   test
 
 
@@ -447,6 +452,8 @@
   
 
   
+src/it/scala
+
src/it/resources
 
   
 org.apache.maven.plugins
@@ -500,9 +507,7 @@
   test
 
 
-  true
-  Integration-Test
-  -Xmx2g -XX:MaxPermSize=512m 
-XX:ReservedCodeCacheSize=512m
+  true
 
   
   
@@ -512,8 +517,9 @@
   test
 
 
-  false
-  Integration-Test
+  true
+  Integration-Test
+  -Xmx1536m -XX:MaxPermSize=512m 
-XX:ReservedCodeCacheSize=512m
 
   
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/623829db/phoenix-spark/src/it/resources/log4j.xml
--
diff --git a/phoenix-spark/src/it/resources/log4j.xml 
b/phoenix-spark/src/it/resources/log4j.xml
index d4799da..58abece 100644
--- a/phoenix-spark/src/it/resources/log4j.xml
+++ b/phoenix-spark/src/it/resources/log4j.xml
@@ -26,6 +26,14 @@
 
   
 
+  
+
+  
+
+  
+
+  
+
   
 
   

http://git-wip-us.apache.org/repos/asf/phoenix/blob/623829db/phoenix-spark/src/it/scala/org/apache/phoenix/spark/PhoenixRDDTest.scala
--
diff --git 
a/phoenix-spark/src/it/scala/org/apache/phoenix/spark/PhoenixRDDTest.scala 
b/phoenix-spark/src/it/scala/org/apache/phoenix/spark/PhoenixRDDTest.scala
deleted file mode 100644
index 63cb6e4..000
--- a/phoenix-spark/src/it/scala/org/apache/phoenix/spark/PhoenixRDDTest.scala
+++ /dev/null
@@ -1,333 +0,0 @@
-/*
-   Licensed 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.spark
-
-import java.sql.{Connection, DriverManager}
-import java.util.Date
-
-import org.apache.hadoop.conf.Configuration
-import org.apache.hadoop.hbase.{HConstants, HBaseTestingUtility}
-import org.apache.phoenix.schema.ColumnNotFoundException
-import org.apache.phoenix.schema.types.PVarchar
-import org.apache.phoenix.util.ColumnInfo
-import org.apache.spark.sql.SQLContext
-import org.apache.spark.sql.types.{StringType, StructField}
-import org.apache.spark.{SparkConf, SparkContext}
-import org.joda.time.DateTime
-import org.scalatest.{BeforeAndAfterAll, FunSuite, Matchers}
-import org.apache.phoenix.spark._
-
-import scala.collection.mutable.ListBuffer
-
-class PhoenixRDDTest extends FunSuite with Matchers with BeforeAndAfterAll {
-  lazy val hbaseTestingUtility = {
-new HBaseTestingUtility()
-  }
-
-  lazy val hbaseConfiguration = {
-val conf = hbaseTestingUtility.getConfiguration
-
-val quorum = conf.get("hbase.zookee

[38/50] [abbrv] phoenix git commit: PHOENIX-1765 Add DAYOFMONTH built-in function (Alicia Ying Shu)

2015-04-16 Thread maryannxue
PHOENIX-1765 Add DAYOFMONTH built-in function (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/0d78e48b
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/0d78e48b
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/0d78e48b

Branch: refs/heads/calcite
Commit: 0d78e48b579739fb85a64fe7258f1838dc1af2c8
Parents: 8975fc1
Author: James Taylor 
Authored: Mon Apr 13 17:05:45 2015 -0700
Committer: James Taylor 
Committed: Mon Apr 13 17:05:45 2015 -0700

--
 .../org/apache/phoenix/end2end/DateTimeIT.java  | 281 +-
 .../end2end/YearMonthSecondFunctionIT.java  | 287 ---
 .../phoenix/expression/ExpressionType.java  |   4 +-
 .../expression/function/DayOfMonthFunction.java |  83 ++
 4 files changed, 365 insertions(+), 290 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/0d78e48b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DateTimeIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DateTimeIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DateTimeIT.java
index 371d82e..0db36df 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DateTimeIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DateTimeIT.java
@@ -42,12 +42,15 @@ import java.sql.Date;
 import java.sql.DriverManager;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
+import java.sql.SQLException;
 import java.sql.Statement;
 import java.sql.Types;
 import java.text.Format;
 import java.util.Calendar;
 
 import org.apache.phoenix.util.DateUtil;
+import org.junit.After;
+import org.junit.Before;
 import org.junit.Test;
 
 
@@ -59,12 +62,21 @@ public class DateTimeIT extends BaseHBaseManagedTimeIT {
 
 public DateTimeIT() throws Exception {
 super();
-conn = DriverManager.getConnection(getUrl());
 date = new Date(System.currentTimeMillis());
+}
+
+@Before
+public void setUp() throws SQLException {
+conn = DriverManager.getConnection(getUrl());
 initAtable();
 }
 
-protected void initAtable() throws Exception { 
+@After
+public void tearDown() throws SQLException {
+conn.close();
+}
+
+private void initAtable() throws SQLException { 
 ensureTableCreated(getUrl(), ATABLE_NAME, (byte[][])null);
 PreparedStatement stmt = conn.prepareStatement(
 "upsert into " + ATABLE_NAME +
@@ -357,4 +369,269 @@ public class DateTimeIT extends BaseHBaseManagedTimeIT {
 assertEquals(ROW1, rs.getString(1));
 assertFalse(rs.next());
 }
+
+private static int callYearFunction(Connection conn, String invocation) 
throws SQLException {
+Statement stmt = conn.createStatement();
+ResultSet rs =
+stmt.executeQuery(String
+.format("SELECT %s FROM SYSTEM.CATALOG LIMIT 1", 
invocation));
+assertTrue(rs.next());
+int returnValue = rs.getInt(1);
+assertFalse(rs.next());
+rs.close();
+stmt.close();
+return returnValue;
+}
+
+private int callYearFunction(String invocation) throws SQLException {
+return callYearFunction(conn, invocation);
+}
+
+@Test
+public void testYearFunctionDate() throws SQLException {
+
+assertEquals(2015, callYearFunction("YEAR(current_date())"));
+
+assertEquals(2015, callYearFunction("YEAR(now())"));
+
+assertEquals(2008, callYearFunction("YEAR(TO_DATE('2008-01-01', 
'-MM-dd', 'local'))"));
+
+assertEquals(2004,
+callYearFunction("YEAR(TO_DATE('2004-12-13 10:13:18', '-MM-dd 
hh:mm:ss'))"));
+
+assertEquals(2015, 
callYearFunction("YEAR(TO_DATE('2015-01-27T16:17:57+00:00'))"));
+
+assertEquals(2005, callYearFunction("YEAR(TO_DATE('2005-12-13 
10:13:18'))"));
+
+assertEquals(2006, callYearFunction("YEAR(TO_DATE('2006-12-13'))"));
+
+assertEquals(2015, callYearFunction("YEAR(TO_DATE('2015-W05'))"));
+
+assertEquals(
+2008,
+callYearFunction("YEAR(TO_DATE('Sat, 3 Feb 2008 03:05:06 GMT', 
'EEE, d MMM  HH:mm:ss z', 'UTC'))"));
+}
+
+@Test
+public void testYearFunctionTimestamp() throws SQLException {
+
+assertEquals(2015, 
callYearFunction("YEAR(TO_TIMESTAMP('2015-01-27T16:17:57+00:00'))"));
+
+assertEquals(2015, 
callYearFunction("YEAR(TO_TIMESTAMP('2015-01-27T16:17:57Z'))"));
+
+assertEquals(2015, 
callYearFunction("YEAR(TO_TIMESTAMP('2015-W10-3'))"));
+
+assertEquals(2015, callYearFunction("YEAR(TO_TIMESTAMP('2015-W05'))"));
+
+assertEquals(2015, callYearFunction("YEAR(TO_TIMESTAMP(

[02/50] [abbrv] phoenix git commit: PHOENIX-1776 The literal -1.0 (floating point) should not be converted to -1 (Integer) (Dave Hacker)

2015-04-16 Thread maryannxue
PHOENIX-1776 The literal -1.0 (floating point) should not be converted to -1 
(Integer) (Dave Hacker)


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

Branch: refs/heads/calcite
Commit: f941e89f4f3a3778282ffc8570c64a181e01c043
Parents: ad2ad0c
Author: Samarth 
Authored: Thu Mar 26 00:37:12 2015 -0700
Committer: Samarth 
Committed: Thu Mar 26 00:37:12 2015 -0700

--
 .../phoenix/end2end/ArithmeticQueryIT.java  | 28 
 .../apache/phoenix/parse/ParseNodeFactory.java  |  4 ++-
 2 files changed, 31 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/f941e89f/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArithmeticQueryIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArithmeticQueryIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArithmeticQueryIT.java
index 2df1827..72eb016 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArithmeticQueryIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArithmeticQueryIT.java
@@ -957,4 +957,32 @@ public class ArithmeticQueryIT extends 
BaseHBaseManagedTimeIT {
 assertTrue(rs.next());
 assertEquals(1.3, rs.getDouble(1), 0.001);
 }
+
+@Test
+public void testFloatingPointUpsert() throws Exception {
+Connection conn = DriverManager.getConnection(getUrl());
+String ddl = "CREATE TABLE test (id VARCHAR not null primary key, name 
VARCHAR, lat FLOAT)";
+conn.createStatement().execute(ddl);
+String dml = "UPSERT INTO test(id,name,lat) VALUES ('testid', 
'testname', -1.00)";
+conn.createStatement().execute(dml);
+conn.commit();
+
+ResultSet rs = conn.createStatement().executeQuery("SELECT lat FROM 
test");
+assertTrue(rs.next());
+assertEquals(-1.0f, rs.getFloat(1), 0.001);
+}
+
+@Test
+public void testFloatingPointMultiplicationUpsert() throws Exception {
+Connection conn = DriverManager.getConnection(getUrl());
+String ddl = "CREATE TABLE test (id VARCHAR not null primary key, name 
VARCHAR, lat FLOAT)";
+conn.createStatement().execute(ddl);
+String dml = "UPSERT INTO test(id,name,lat) VALUES ('testid', 
'testname', -1.00 * 1)";
+conn.createStatement().execute(dml);
+conn.commit();
+
+ResultSet rs = conn.createStatement().executeQuery("SELECT lat FROM 
test");
+assertTrue(rs.next());
+assertEquals(-1.0f, rs.getFloat(1), 0.001);
+}
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/phoenix/blob/f941e89f/phoenix-core/src/main/java/org/apache/phoenix/parse/ParseNodeFactory.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/parse/ParseNodeFactory.java 
b/phoenix-core/src/main/java/org/apache/phoenix/parse/ParseNodeFactory.java
index 931f327..eb1768c 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/parse/ParseNodeFactory.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/parse/ParseNodeFactory.java
@@ -47,6 +47,7 @@ import org.apache.phoenix.schema.SortOrder;
 import org.apache.phoenix.schema.TypeMismatchException;
 import org.apache.phoenix.schema.stats.StatisticsCollectionScope;
 import org.apache.phoenix.schema.types.PDataType;
+import org.apache.phoenix.schema.types.PLong;
 import org.apache.phoenix.schema.types.PTimestamp;
 import org.apache.phoenix.util.SchemaUtil;
 
@@ -577,7 +578,8 @@ public class ParseNodeFactory {
 
 public ParseNode negate(ParseNode child) {
 // Prevents reparsing of -1 from becoming 1*-1 and 1*1*-1 with each 
re-parsing
-if (LiteralParseNode.ONE.equals(child)) {
+if (LiteralParseNode.ONE.equals(child) && 
((LiteralParseNode)child).getType().isCoercibleTo(
+PLong.INSTANCE)) {
 return LiteralParseNode.MINUS_ONE;
 }
 return new 
MultiplyParseNode(Arrays.asList(child,LiteralParseNode.MINUS_ONE));



[31/50] [abbrv] phoenix git commit: PHOENIX-1742 Update pom to Junit 4.12

2015-04-16 Thread maryannxue
PHOENIX-1742 Update pom to Junit 4.12


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

Branch: refs/heads/calcite
Commit: ca4e21242a573f4b58fb8959d83ff3b023f057a5
Parents: 5c32d19
Author: Samarth 
Authored: Tue Apr 7 18:30:55 2015 -0700
Committer: Samarth 
Committed: Tue Apr 7 18:30:55 2015 -0700

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


http://git-wip-us.apache.org/repos/asf/phoenix/blob/ca4e2124/pom.xml
--
diff --git a/pom.xml b/pom.xml
index bfafe78..4793cf2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -108,7 +108,7 @@
 
 
 1.8.5
-4.12-beta-3
+4.12
 
 
 2.9



[06/50] [abbrv] phoenix git commit: PHOENIX-1457 Use high priority queue for metadata endpoint calls

2015-04-16 Thread maryannxue
PHOENIX-1457 Use high priority queue for metadata endpoint calls


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

Branch: refs/heads/calcite
Commit: a7d7dfb52622a586482030ae6904d0c53ed7a4af
Parents: b256fde
Author: Thomas D'Silva 
Authored: Tue Mar 24 17:17:44 2015 -0700
Committer: Thomas 
Committed: Fri Mar 27 11:45:41 2015 -0700

--
 .../phoenix/end2end/index/IndexHandlerIT.java   |  12 +-
 .../phoenix/end2end/index/IndexQosIT.java   | 243 ---
 .../apache/phoenix/rpc/PhoenixClientRpcIT.java  | 122 ++
 .../apache/phoenix/rpc/PhoenixServerRpcIT.java  | 235 ++
 .../TestPhoenixIndexRpcSchedulerFactory.java|  64 +
 .../hbase/ipc/PhoenixIndexRpcScheduler.java | 123 --
 .../hadoop/hbase/ipc/PhoenixRpcScheduler.java   | 123 ++
 .../hbase/ipc/PhoenixRpcSchedulerFactory.java   |  95 
 .../controller/ClientRpcControllerFactory.java  |  60 +
 .../ipc/controller/IndexRpcController.java  |  51 
 .../ipc/controller/MetadataRpcController.java   |  55 +
 .../controller/ServerRpcControllerFactory.java  |  62 +
 .../index/IndexQosRpcControllerFactory.java |  82 ---
 .../ipc/PhoenixIndexRpcSchedulerFactory.java|  90 ---
 .../phoenix/jdbc/PhoenixDatabaseMetaData.java   |   4 -
 .../org/apache/phoenix/query/QueryServices.java |   5 +-
 .../phoenix/query/QueryServicesOptions.java |  12 +-
 .../org/apache/phoenix/util/SchemaUtil.java |   7 -
 .../hbase/ipc/PhoenixIndexRpcSchedulerTest.java |  16 +-
 .../PhoenixIndexRpcSchedulerFactoryTest.java| 106 
 .../PhoenixRpcSchedulerFactoryTest.java | 125 ++
 .../java/org/apache/phoenix/query/BaseTest.java |  12 +-
 22 files changed, 1023 insertions(+), 681 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/a7d7dfb5/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexHandlerIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexHandlerIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexHandlerIT.java
index 1507d6b..20a780a 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexHandlerIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexHandlerIT.java
@@ -35,8 +35,8 @@ import org.apache.hadoop.hbase.client.Put;
 import org.apache.hadoop.hbase.ipc.DelegatingPayloadCarryingRpcController;
 import org.apache.hadoop.hbase.ipc.PayloadCarryingRpcController;
 import org.apache.hadoop.hbase.ipc.RpcControllerFactory;
+import org.apache.hadoop.hbase.ipc.controller.ServerRpcControllerFactory;
 import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.phoenix.hbase.index.IndexQosRpcControllerFactory;
 import org.apache.phoenix.hbase.index.TableName;
 import org.apache.phoenix.query.QueryServicesOptions;
 import org.junit.After;
@@ -53,11 +53,11 @@ public class IndexHandlerIT {
 
 public static class CountingIndexClientRpcFactory extends 
RpcControllerFactory {
 
-private IndexQosRpcControllerFactory delegate;
+private ServerRpcControllerFactory delegate;
 
 public CountingIndexClientRpcFactory(Configuration conf) {
 super(conf);
-this.delegate = new IndexQosRpcControllerFactory(conf);
+this.delegate = new ServerRpcControllerFactory(conf);
 }
 
 @Override
@@ -146,8 +146,8 @@ public class IndexHandlerIT {
 conf.set(RpcControllerFactory.CUSTOM_CONTROLLER_CONF_KEY,
 CountingIndexClientRpcFactory.class.getName());
 // and set the index table as the current table
-conf.setStrings(IndexQosRpcControllerFactory.INDEX_TABLE_NAMES_KEY,
-TestTable.getTableNameString());
+//conf.setStrings(PhoenixRpcControllerFactory.INDEX_TABLE_NAMES_KEY,
+//TestTable.getTableNameString());
 HTable table = new HTable(conf, TestTable.getTableName());
 
 // do a write to the table
@@ -159,7 +159,7 @@ public class IndexHandlerIT {
 // check the counts on the rpc controller
 assertEquals("Didn't get the expected number of index priority 
writes!", 1,
 (int) CountingIndexClientRpcController.priorityCounts
-.get(QueryServicesOptions.DEFAULT_INDEX_MIN_PRIORITY));
+.get(QueryServicesOptions.DEFAULT_INDEX_PRIORITY));
 
 table.close();
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/a7d7dfb5/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexQosIT.java
--

[16/50] [abbrv] phoenix git commit: PHOENIX-1712 Add INSTR function

2015-04-16 Thread maryannxue
PHOENIX-1712 Add INSTR function

Add method for detecting a substring within another string.

Signed-off-by: Gabriel Reid 


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

Branch: refs/heads/calcite
Commit: 1f942b1f0e815674f1917c18167d848769435148
Parents: f766a78
Author: NAVEEN MADHIRE 
Authored: Mon Mar 16 23:11:45 2015 -0400
Committer: Gabriel Reid 
Committed: Thu Apr 2 21:07:55 2015 +0200

--
 .../apache/phoenix/end2end/InstrFunctionIT.java | 126 +++
 .../phoenix/expression/ExpressionType.java  |   4 +-
 .../expression/function/InstrFunction.java  | 105 
 .../expression/function/InstrFunctionTest.java  | 108 
 4 files changed, 342 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/1f942b1f/phoenix-core/src/it/java/org/apache/phoenix/end2end/InstrFunctionIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/InstrFunctionIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/InstrFunctionIT.java
new file mode 100644
index 000..57c0661
--- /dev/null
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/InstrFunctionIT.java
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.phoenix.end2end;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+
+import org.junit.Test;
+
+public class InstrFunctionIT extends BaseHBaseManagedTimeIT {
+private void initTable(Connection conn, String sortOrder, String s, String 
subStr) throws Exception {
+String ddl = "CREATE TABLE SAMPLE (name VARCHAR NOT NULL PRIMARY KEY " 
+ sortOrder + ", substr VARCHAR)";
+conn.createStatement().execute(ddl);
+String dml = "UPSERT INTO SAMPLE VALUES(?,?)";
+PreparedStatement stmt = conn.prepareStatement(dml);
+stmt.setString(1, s);
+stmt.setString(2, subStr);
+stmt.execute();
+conn.commit();
+}
+
+ private void testInstr(Connection conn, String queryToExecute, Integer 
expValue) throws Exception {
+ResultSet rs;
+rs = conn.createStatement().executeQuery(queryToExecute);
+assertTrue(rs.next());
+assertEquals(expValue.intValue(), rs.getInt(1));
+assertFalse(rs.next());
+
+}
+
+  private void testInstrFilter(Connection conn, String queryToExecute, 
String expected) throws Exception {
+ResultSet rs;
+PreparedStatement stmt = conn.prepareStatement(queryToExecute);
+rs = stmt.executeQuery();
+assertTrue(rs.next());
+assertEquals(expected, rs.getString(1));
+
+}
+
+@Test
+public void testSingleByteInstrAscending() throws Exception {
+Connection conn = DriverManager.getConnection(getUrl());
+initTable(conn, "ASC", "abcdefghijkl","fgh");
+String queryToExecute = "SELECT INSTR(name, 'fgh') FROM SAMPLE";
+testInstr(conn, queryToExecute, 5);
+}
+
+@Test
+public void testSingleByteInstrDescending() throws Exception {
+Connection conn = DriverManager.getConnection(getUrl());
+initTable(conn, "DESC", "abcdefghijkl","fgh");
+String queryToExecute = "SELECT INSTR(name, 'fgh') FROM SAMPLE";
+testInstr(conn, queryToExecute, 5);
+}
+
+@Test
+public void testSingleByteInstrAscendingNoString() throws Exception {
+Connection conn = DriverManager.getConnection(getUrl());
+initTable(conn, "ASC", "abcde fghijkl","lmn");
+String queryToExecute = "SELECT INSTR(name, 'lmn') FROM SAMPLE";
+

[43/50] [abbrv] phoenix git commit: PHOENIX-1287 Use the joni byte[] regex engine in place of j.u.regex (Shuxiong Ye)

2015-04-16 Thread maryannxue
PHOENIX-1287 Use the joni byte[] regex engine in place of j.u.regex (Shuxiong 
Ye)


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

Branch: refs/heads/calcite
Commit: 3f6b25947d07ea0d7756556dd80e951f12ceda69
Parents: 7ef1718
Author: James Taylor 
Authored: Tue Apr 14 12:09:17 2015 -0700
Committer: James Taylor 
Committed: Tue Apr 14 12:09:17 2015 -0700

--
 .../src/build/components-major-client.xml   |   2 +
 phoenix-core/pom.xml|   5 +
 .../phoenix/end2end/LikeExpressionIT.java   |  88 
 .../end2end/RegexpReplaceFunctionIT.java| 100 +
 .../phoenix/end2end/RegexpSubstrFunctionIT.java |  43 ++--
 .../phoenix/compile/ExpressionCompiler.java |  15 +-
 .../expression/ByteBasedLikeExpression.java |  48 +
 .../phoenix/expression/ExpressionType.java  |  16 +-
 .../phoenix/expression/LikeExpression.java  |  64 +++---
 .../expression/StringBasedLikeExpression.java   |  48 +
 .../ByteBasedRegexpReplaceFunction.java |  40 
 .../function/ByteBasedRegexpSplitFunction.java  |  38 
 .../function/ByteBasedRegexpSubstrFunction.java |  38 
 .../function/RegexpReplaceFunction.java |  38 ++--
 .../function/RegexpSplitFunction.java   |  54 +++--
 .../function/RegexpSubstrFunction.java  |  48 ++---
 .../StringBasedRegexpReplaceFunction.java   |  40 
 .../StringBasedRegexpSplitFunction.java |  38 
 .../StringBasedRegexpSubstrFunction.java|  38 
 .../util/regex/AbstractBasePattern.java |  33 +++
 .../util/regex/AbstractBaseSplitter.java|  24 +++
 .../expression/util/regex/GuavaSplitter.java|  54 +
 .../expression/util/regex/JONIPattern.java  | 201 +++
 .../expression/util/regex/JavaPattern.java  |  93 +
 .../visitor/CloneExpressionVisitor.java |   3 +-
 .../phoenix/parse/RegexpReplaceParseNode.java   |  55 +
 .../phoenix/parse/RegexpSplitParseNode.java |  55 +
 .../phoenix/parse/RegexpSubstrParseNode.java|  55 +
 .../org/apache/phoenix/query/QueryServices.java |   2 +
 .../phoenix/query/QueryServicesOptions.java |  14 +-
 .../phoenix/schema/types/PArrayDataType.java|  91 +
 .../org/apache/phoenix/util/StringUtil.java |  68 ++-
 .../phoenix/compile/WhereOptimizerTest.java |  18 +-
 .../phoenix/expression/ILikeExpressionTest.java |  32 ++-
 .../phoenix/expression/LikeExpressionTest.java  |  39 +++-
 .../expression/RegexpReplaceFunctionTest.java   |  81 
 .../expression/RegexpSplitFunctionTest.java |  94 +
 .../expression/RegexpSubstrFunctionTest.java|  83 
 .../expression/SortOrderExpressionTest.java |  12 +-
 .../util/regex/PatternPerformanceTest.java  | 144 +
 .../org/apache/phoenix/util/StringUtilTest.java |  32 ++-
 .../java/org/apache/phoenix/util/TestUtil.java  |  28 ++-
 pom.xml |   1 +
 43 files changed, 1952 insertions(+), 161 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/3f6b2594/phoenix-assembly/src/build/components-major-client.xml
--
diff --git a/phoenix-assembly/src/build/components-major-client.xml 
b/phoenix-assembly/src/build/components-major-client.xml
index 768cac0..7a2909b 100644
--- a/phoenix-assembly/src/build/components-major-client.xml
+++ b/phoenix-assembly/src/build/components-major-client.xml
@@ -49,6 +49,8 @@
 org.codehaus.jackson:jackson-core-asl
 commons-collections:commons-collections
 joda-time:joda-time
+org.jruby.joni:joni
+org.jruby.jcodings:jcodings
   
 
   

http://git-wip-us.apache.org/repos/asf/phoenix/blob/3f6b2594/phoenix-core/pom.xml
--
diff --git a/phoenix-core/pom.xml b/phoenix-core/pom.xml
index 5e0aff7..45b8d73 100644
--- a/phoenix-core/pom.xml
+++ b/phoenix-core/pom.xml
@@ -417,5 +417,10 @@
   org.apache.hadoop
   hadoop-minicluster
 
+
+org.jruby.joni
+joni
+${joni.version}
+
   
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/3f6b2594/phoenix-core/src/it/java/org/apache/phoenix/end2end/LikeExpressionIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/LikeExpressionIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/LikeExpressionIT.java
new file mode 100644
index 000..1ee0669
--- /dev/null
+++ b/phoenix-core/src/it/j

[07/50] [abbrv] phoenix git commit: PHOENIX-1722 Speedup CONVERT_TZ function (Vaclav Loffelmann)

2015-04-16 Thread maryannxue
PHOENIX-1722 Speedup CONVERT_TZ function (Vaclav Loffelmann)


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

Branch: refs/heads/calcite
Commit: b9002b7caa54c4fde04b27fe6963719a8d821d7c
Parents: a7d7dfb
Author: Samarth 
Authored: Fri Mar 27 14:58:40 2015 -0700
Committer: Samarth 
Committed: Fri Mar 27 14:58:40 2015 -0700

--
 .../end2end/ConvertTimezoneFunctionIT.java  | 24 +-
 .../apache/phoenix/cache/JodaTimezoneCache.java | 84 
 .../function/ConvertTimezoneFunction.java   | 38 +++--
 .../function/TimezoneOffsetFunction.java| 25 ++
 .../phoenix/cache/JodaTimezoneCacheTest.java| 51 
 pom.xml |  2 +-
 6 files changed, 173 insertions(+), 51 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/b9002b7c/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConvertTimezoneFunctionIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConvertTimezoneFunctionIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConvertTimezoneFunctionIT.java
index d89a03b..f415dc6 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConvertTimezoneFunctionIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConvertTimezoneFunctionIT.java
@@ -23,8 +23,10 @@ import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.ResultSet;
 import java.sql.SQLException;
+import java.sql.Statement;
 
 import org.apache.phoenix.exception.SQLExceptionCode;
+import static org.junit.Assert.assertFalse;
 import org.junit.Test;
 
 /**
@@ -129,7 +131,7 @@ public class ConvertTimezoneFunctionIT extends 
BaseHBaseManagedTimeIT {
 try {
 ResultSet rs = conn.createStatement().executeQuery(
 "SELECT k1, dates, CONVERT_TZ(dates, 'UNKNOWN_TIMEZONE', 
'America/Adak') FROM TIMEZONE_OFFSET_TEST");
-
+
 rs.next();
 rs.getDate(3).getTime();
 fail();
@@ -137,4 +139,24 @@ public class ConvertTimezoneFunctionIT extends 
BaseHBaseManagedTimeIT {
 assertEquals(SQLExceptionCode.ILLEGAL_DATA.getErrorCode(), 
e.getErrorCode());
 }
 }
+
+   @Test
+   public void testConvertMultipleRecords() throws Exception {
+   Connection conn = DriverManager.getConnection(getUrl());
+   String ddl = "CREATE TABLE IF NOT EXISTS TIMEZONE_OFFSET_TEST 
(k1 INTEGER NOT NULL, dates DATE CONSTRAINT pk PRIMARY KEY (k1))";
+   Statement stmt = conn.createStatement();
+   stmt.execute(ddl);
+   stmt.execute("UPSERT INTO TIMEZONE_OFFSET_TEST (k1, dates) 
VALUES (1, TO_DATE('2014-03-01 00:00:00'))");
+   stmt.execute("UPSERT INTO TIMEZONE_OFFSET_TEST (k1, dates) 
VALUES (2, TO_DATE('2014-03-01 00:00:00'))");
+   conn.commit();
+
+   ResultSet rs = stmt.executeQuery(
+   "SELECT k1, dates, CONVERT_TZ(dates, 'UTC', 
'America/Adak') FROM TIMEZONE_OFFSET_TEST");
+
+   assertTrue(rs.next());
+   assertEquals(139359600L, rs.getDate(3).getTime()); //Fri, 
28 Feb 2014 14:00:00
+   assertTrue(rs.next());
+   assertEquals(139359600L, rs.getDate(3).getTime()); //Fri, 
28 Feb 2014 14:00:00
+   assertFalse(rs.next());
+   }
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/b9002b7c/phoenix-core/src/main/java/org/apache/phoenix/cache/JodaTimezoneCache.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/cache/JodaTimezoneCache.java 
b/phoenix-core/src/main/java/org/apache/phoenix/cache/JodaTimezoneCache.java
new file mode 100644
index 000..54904d7
--- /dev/null
+++ b/phoenix-core/src/main/java/org/apache/phoenix/cache/JodaTimezoneCache.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2015 Apache Software Foundation.
+ *
+ * Licensed 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.cache;
+
+

[37/50] [abbrv] phoenix git commit: PHOENIX-1846 Add MINUTE built-in function (Alicia Ying Shu)

2015-04-16 Thread maryannxue
PHOENIX-1846 Add MINUTE built-in function (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/8975fc1a
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/8975fc1a
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/8975fc1a

Branch: refs/heads/calcite
Commit: 8975fc1a427700fc3f13d34ddd610404781683ae
Parents: 36a7f24
Author: James Taylor 
Authored: Mon Apr 13 16:32:31 2015 -0700
Committer: James Taylor 
Committed: Mon Apr 13 16:32:31 2015 -0700

--
 .../end2end/YearMonthSecondFunctionIT.java  | 26 +++
 .../phoenix/expression/ExpressionType.java  |  4 +-
 .../expression/function/MinuteFunction.java | 81 
 3 files changed, 110 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/8975fc1a/phoenix-core/src/it/java/org/apache/phoenix/end2end/YearMonthSecondFunctionIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/YearMonthSecondFunctionIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/YearMonthSecondFunctionIT.java
index cc51bdd..1206ee4 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/YearMonthSecondFunctionIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/YearMonthSecondFunctionIT.java
@@ -258,4 +258,30 @@ public class YearMonthSecondFunctionIT extends 
BaseHBaseManagedTimeIT {
 assertEquals(new Date(date.getTime()-500), rs.getDate(2));
 assertFalse(rs.next());
 }
+
+@Test
+public void testMinuteFuncAgainstColumns() throws Exception {
+String ddl =
+"CREATE TABLE IF NOT EXISTS T1 (k1 INTEGER NOT NULL, dates 
DATE, timestamps TIMESTAMP, times TIME, " +
+"unsignedDates UNSIGNED_DATE, unsignedTimestamps 
UNSIGNED_TIMESTAMP, unsignedTimes UNSIGNED_TIME CONSTRAINT pk PRIMARY KEY 
(k1))";
+conn.createStatement().execute(ddl);
+String dml = "UPSERT INTO T1 VALUES (1, TO_DATE('2004-03-01 
00:10:10'), TO_TIMESTAMP('2006-04-12 00:20:20'), TO_TIME('2008-05-16 
10:30:30'), " +
+"TO_DATE('2010-06-20 00:40:40:789', '-MM-dd 
HH:mm:ss:SSS'), TO_TIMESTAMP('2012-07-28'), TO_TIME('2015-12-25 00:50:50'))";
+conn.createStatement().execute(dml);
+dml = "UPSERT INTO T1 VALUES (2, TO_DATE('2004-03-01 00:10:10'), 
TO_TIMESTAMP('2006-04-12 00:50:20'), TO_TIME('2008-05-16 10:30:30'), " +
+"TO_DATE('2010-06-20 00:40:40:789', '-MM-dd 
HH:mm:ss:SSS'), TO_TIMESTAMP('2012-07-28'), TO_TIME('2015-12-25 00:50:50'))";
+conn.createStatement().execute(dml);
+conn.commit();
+
+ResultSet rs = conn.createStatement().executeQuery("SELECT k1, 
MINUTE(dates), MINUTE(times), MINUTE(unsignedDates), 
MINUTE(unsignedTimestamps), " +
+"MINUTE(unsignedTimes) FROM T1 where MINUTE(timestamps)=20");
+assertTrue(rs.next());
+assertEquals(1, rs.getInt(1));
+assertEquals(10, rs.getInt(2));
+assertEquals(30, rs.getInt(3));
+assertEquals(40, rs.getInt(4));
+assertEquals(0, rs.getInt(5));
+assertEquals(50, rs.getInt(6));
+assertFalse(rs.next());
+}
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/phoenix/blob/8975fc1a/phoenix-core/src/main/java/org/apache/phoenix/expression/ExpressionType.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/ExpressionType.java 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/ExpressionType.java
index c25b1cc..d42c5f2 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/ExpressionType.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/ExpressionType.java
@@ -52,6 +52,7 @@ import org.apache.phoenix.expression.function.LpadFunction;
 import org.apache.phoenix.expression.function.MD5Function;
 import org.apache.phoenix.expression.function.MaxAggregateFunction;
 import org.apache.phoenix.expression.function.MinAggregateFunction;
+import org.apache.phoenix.expression.function.MinuteFunction;
 import org.apache.phoenix.expression.function.MonthFunction;
 import org.apache.phoenix.expression.function.NowFunction;
 import org.apache.phoenix.expression.function.NthValueFunction;
@@ -207,7 +208,8 @@ public enum ExpressionType {
 WeekFunction(WeekFunction.class),
 HourFunction(HourFunction.class),
 NowFunction(NowFunction.class),
-InstrFunction(InstrFunction.class)
+InstrFunction(InstrFunction.class),
+MinuteFunction(MinuteFunction.class)
 ;
 
 ExpressionType(Class clazz) {

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

[45/50] [abbrv] phoenix git commit: PHOENIX-1867 Add joni library to server assembly files (Shuxiong Ye)

2015-04-16 Thread maryannxue
PHOENIX-1867 Add joni library to server assembly files (Shuxiong Ye)


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

Branch: refs/heads/calcite
Commit: 295225060535d3030789a13817d55040b3db99de
Parents: b0c28a2
Author: James Taylor 
Authored: Wed Apr 15 00:38:45 2015 -0700
Committer: James Taylor 
Committed: Wed Apr 15 00:38:45 2015 -0700

--
 phoenix-assembly/src/build/server-without-antlr.xml | 2 ++
 phoenix-assembly/src/build/server.xml   | 2 ++
 2 files changed, 4 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/29522506/phoenix-assembly/src/build/server-without-antlr.xml
--
diff --git a/phoenix-assembly/src/build/server-without-antlr.xml 
b/phoenix-assembly/src/build/server-without-antlr.xml
index 1750d1c..072ade0 100644
--- a/phoenix-assembly/src/build/server-without-antlr.xml
+++ b/phoenix-assembly/src/build/server-without-antlr.xml
@@ -36,6 +36,8 @@
   
 org.apache.phoenix:phoenix-core
 org.iq80.snappy:snappy
+org.jruby.joni:joni
+org.jruby.jcodings:jcodings
   
 
   

http://git-wip-us.apache.org/repos/asf/phoenix/blob/29522506/phoenix-assembly/src/build/server.xml
--
diff --git a/phoenix-assembly/src/build/server.xml 
b/phoenix-assembly/src/build/server.xml
index 5ec2106..12d3d81 100644
--- a/phoenix-assembly/src/build/server.xml
+++ b/phoenix-assembly/src/build/server.xml
@@ -36,6 +36,8 @@
   
 org.apache.phoenix:phoenix-core
 org.iq80.snappy:snappy
+org.jruby.joni:joni
+org.jruby.jcodings:jcodings
   
 
 



[12/50] [abbrv] phoenix git commit: PHOENIX-1797 Add more tests for date literals (Mike Friedman)

2015-04-16 Thread maryannxue
PHOENIX-1797 Add more tests for date literals (Mike Friedman)


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

Branch: refs/heads/calcite
Commit: 0eca5f17f98bf7bf25541f3574256a532747fe6f
Parents: e2cf44c
Author: James Taylor 
Authored: Tue Mar 31 14:12:14 2015 -0700
Committer: James Taylor 
Committed: Tue Mar 31 14:13:40 2015 -0700

--
 .../org/apache/phoenix/end2end/DateTimeIT.java  | 360 +++
 .../apache/phoenix/parse/QueryParserTest.java   |  18 +
 2 files changed, 378 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/0eca5f17/phoenix-core/src/it/java/org/apache/phoenix/end2end/DateTimeIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DateTimeIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DateTimeIT.java
new file mode 100644
index 000..371d82e
--- /dev/null
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DateTimeIT.java
@@ -0,0 +1,360 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.phoenix.end2end;
+
+import static org.apache.phoenix.util.TestUtil.ATABLE_NAME;
+import static org.apache.phoenix.util.TestUtil.A_VALUE;
+import static org.apache.phoenix.util.TestUtil.B_VALUE;
+import static org.apache.phoenix.util.TestUtil.C_VALUE;
+import static org.apache.phoenix.util.TestUtil.E_VALUE;
+import static org.apache.phoenix.util.TestUtil.MILLIS_IN_DAY;
+import static org.apache.phoenix.util.TestUtil.ROW1;
+import static org.apache.phoenix.util.TestUtil.ROW2;
+import static org.apache.phoenix.util.TestUtil.ROW3;
+import static org.apache.phoenix.util.TestUtil.ROW4;
+import static org.apache.phoenix.util.TestUtil.ROW5;
+import static org.apache.phoenix.util.TestUtil.ROW6;
+import static org.apache.phoenix.util.TestUtil.ROW7;
+import static org.apache.phoenix.util.TestUtil.ROW8;
+import static org.apache.phoenix.util.TestUtil.ROW9;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.math.BigDecimal;
+import java.sql.Connection;
+import java.sql.Date;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.Statement;
+import java.sql.Types;
+import java.text.Format;
+import java.util.Calendar;
+
+import org.apache.phoenix.util.DateUtil;
+import org.junit.Test;
+
+
+public class DateTimeIT extends BaseHBaseManagedTimeIT {
+
+protected Connection conn;
+protected Date date;
+protected static final String tenantId = getOrganizationId();
+
+public DateTimeIT() throws Exception {
+super();
+conn = DriverManager.getConnection(getUrl());
+date = new Date(System.currentTimeMillis());
+initAtable();
+}
+
+protected void initAtable() throws Exception { 
+ensureTableCreated(getUrl(), ATABLE_NAME, (byte[][])null);
+PreparedStatement stmt = conn.prepareStatement(
+"upsert into " + ATABLE_NAME +
+"(" +
+"ORGANIZATION_ID, " +
+"ENTITY_ID, " +
+"A_STRING, " +
+"B_STRING, " +
+"A_INTEGER, " +
+"A_DATE, " +
+"X_DECIMAL, " +
+"X_LONG, " +
+"X_INTEGER," +
+"Y_INTEGER," +
+"A_BYTE," +
+"A_SHORT," +
+"A_FLOAT," +
+"A_DOUBLE," +
+"A_UNSIGNED_FLOAT," +
+"A_UNSIGNED_DOUBLE)" +
+"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
+stmt.setString(1, tenantId);
+stmt.setString(2, ROW1);
+stmt.setString(3, A_VALUE);
+stmt.setString(4, B_VALUE);
+stmt.setInt(5, 1);
+stmt.setDate(6, date);
+

[23/50] [abbrv] phoenix git commit: PHOENIX-1809 Improve explain plan

2015-04-16 Thread maryannxue
PHOENIX-1809 Improve explain plan


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

Branch: refs/heads/calcite
Commit: c823be992460c4211bce713d7e24a125b108c2b8
Parents: 9bbd5ea
Author: James Taylor 
Authored: Sat Apr 4 13:20:31 2015 -0700
Committer: James Taylor 
Committed: Sun Apr 5 14:07:51 2015 -0700

--
 .../org/apache/phoenix/end2end/HashJoinIT.java  |  3 -
 .../org/apache/phoenix/end2end/KeyOnlyIT.java   |  2 +-
 .../phoenix/end2end/QueryWithLimitIT.java   |  2 +-
 .../phoenix/iterate/BaseResultIterators.java|  2 +-
 .../apache/phoenix/iterate/ExplainTable.java| 82 +++-
 .../iterate/MergeSortTopNResultIterator.java|  1 -
 .../java/org/apache/phoenix/util/ScanUtil.java  | 19 -
 .../org/apache/phoenix/query/QueryPlanTest.java |  2 -
 8 files changed, 50 insertions(+), 63 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/c823be99/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java
index 596e5e9..1a2a1d0 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java
@@ -395,7 +395,6 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT {
  * LEFT JOIN joinOrderTable o ON o.item_id = i.item_id 
LIMIT 4
  */
 "CLIENT SERIAL 1-WAY FULL SCAN OVER " + 
JOIN_SUPPLIER_TABLE_DISPLAY_NAME + "\n" +
-"SERVER FILTER BY PageFilter 4\n" +
 "SERVER 4 ROW LIMIT\n" +
 "CLIENT 4 ROW LIMIT\n" +
 "PARALLEL LEFT-JOIN TABLE 0\n" +
@@ -777,7 +776,6 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT {
  * LEFT JOIN joinOrderTable o ON o.item_id = i.item_id 
LIMIT 4
  */
 "CLIENT SERIAL 1-WAY FULL SCAN OVER " + 
JOIN_SUPPLIER_TABLE_DISPLAY_NAME + "\n" +
-"SERVER FILTER BY PageFilter 4\n" +
 "SERVER 4 ROW LIMIT\n" +
 "CLIENT 4 ROW LIMIT\n" +
 "PARALLEL LEFT-JOIN TABLE 0\n" +
@@ -1179,7 +1177,6 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT {
  * LEFT JOIN joinOrderTable o ON o.item_id = i.item_id 
LIMIT 4
  */
 "CLIENT SERIAL 1-WAY FULL SCAN OVER " + 
JOIN_SUPPLIER_TABLE_DISPLAY_NAME + "\n" +
-"SERVER FILTER BY PageFilter 4\n" +
 "SERVER 4 ROW LIMIT\n" +
 "CLIENT 4 ROW LIMIT\n" +
 "PARALLEL LEFT-JOIN TABLE 0\n" +

http://git-wip-us.apache.org/repos/asf/phoenix/blob/c823be99/phoenix-core/src/it/java/org/apache/phoenix/end2end/KeyOnlyIT.java
--
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/KeyOnlyIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/KeyOnlyIT.java
index 7470598..dca57b4 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/KeyOnlyIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/KeyOnlyIT.java
@@ -180,7 +180,7 @@ public class KeyOnlyIT extends 
BaseOwnClusterClientManagedTimeIT {
 
 rs = conn.createStatement().executeQuery("EXPLAIN " + query);
 assertEquals("CLIENT SERIAL 1-WAY FULL SCAN OVER KEYONLY\n" + 
-"SERVER FILTER BY FIRST KEY ONLY AND PageFilter 1\n" + 
+"SERVER FILTER BY FIRST KEY ONLY\n" + 
 "SERVER 1 ROW LIMIT\n" + 
 "CLIENT 1 ROW LIMIT", QueryUtil.getExplainPlan(rs));
 conn.close();

http://git-wip-us.apache.org/repos/asf/phoenix/blob/c823be99/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryWithLimitIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryWithLimitIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryWithLimitIT.java
index 437bf37..c05c92d 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryWithLimitIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryWithLimitIT.java
@@ -74,7 +74,7 @@ public class QueryWithLimitIT extends 
BaseOwnClusterHBaseManagedTimeIT {
 
 rs = conn.createStatement().executeQuery("EXPLAIN " + query);
 assertEquals("CLIENT SERI

[20/50] [abbrv] phoenix git commit: PHOENIX-1683 Support HBase HA Query(timeline-consistent region replica read) (Rajeshbabu Chintaguntla)

2015-04-16 Thread maryannxue
PHOENIX-1683 Support HBase HA Query(timeline-consistent region replica read) 
(Rajeshbabu Chintaguntla)


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

Branch: refs/heads/calcite
Commit: 742ca13d356c13a0055bd63299940219e14827fb
Parents: 3a0ce7d
Author: Rajeshbabu Chintaguntla 
Authored: Fri Apr 3 14:12:25 2015 +0530
Committer: Rajeshbabu Chintaguntla 
Committed: Fri Apr 3 14:12:25 2015 +0530

--
 .../apache/phoenix/end2end/AlterSessionIT.java  | 92 
 phoenix-core/src/main/antlr3/PhoenixSQL.g   |  8 ++
 .../apache/phoenix/execute/BaseQueryPlan.java   |  6 ++
 .../apache/phoenix/iterate/ExplainTable.java|  7 +-
 .../apache/phoenix/jdbc/PhoenixConnection.java  | 15 +++-
 .../apache/phoenix/jdbc/PhoenixStatement.java   | 56 
 .../phoenix/parse/AlterSessionStatement.java| 38 
 .../apache/phoenix/parse/ParseNodeFactory.java  |  4 +
 .../org/apache/phoenix/query/QueryServices.java |  2 +
 .../phoenix/query/QueryServicesOptions.java |  3 +
 .../java/org/apache/phoenix/util/JDBCUtil.java  | 42 +++--
 .../org/apache/phoenix/util/PhoenixRuntime.java |  5 ++
 .../org/apache/phoenix/util/JDBCUtilTest.java   | 15 
 13 files changed, 284 insertions(+), 9 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/742ca13d/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterSessionIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterSessionIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterSessionIT.java
new file mode 100644
index 000..d97d6d4
--- /dev/null
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterSessionIT.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.phoenix.end2end;
+
+import org.apache.hadoop.hbase.client.Consistency;
+import org.apache.phoenix.jdbc.PhoenixConnection;
+import org.apache.phoenix.util.PhoenixRuntime;
+import org.apache.phoenix.util.PropertiesUtil;
+import org.apache.phoenix.util.QueryUtil;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.Statement;
+import java.util.Properties;
+
+import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+/**
+ *
+ * Basic tests for Alter Session Statements
+ *
+ */
+public class AlterSessionIT extends BaseHBaseManagedTimeIT {
+
+Connection testConn;
+
+@Before
+public void initTable() throws Exception {
+Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+testConn = DriverManager.getConnection(getUrl(), props);
+assertEquals(Consistency.STRONG, 
((PhoenixConnection)testConn).getConsistency());
+testConn.createStatement().execute("create table AlterSessionIT (col1 
varchar primary key)");
+testConn.commit();
+}
+
+@Test
+public void testUpdateConsistency() throws Exception {
+try {
+Statement st = testConn.createStatement();
+st.execute("alter session set Consistency = 'timeline'");
+ResultSet rs = st.executeQuery("explain select * from 
AlterSessionIT");
+assertEquals(Consistency.TIMELINE, 
((PhoenixConnection)testConn).getConsistency());
+String queryPlan = QueryUtil.getExplainPlan(rs);
+assertTrue(queryPlan.indexOf("TIMELINE") > 0);
+
+// turn off timeline read consistency
+st.execute("alter session set Consistency = 'strong'");
+rs = st.executeQuery("explain select * from AlterSessionIT");
+queryPlan = QueryUtil.getExplainPlan(rs);
+assertTrue(queryPlan.indexOf("TIMELINE") < 0);
+}

[24/50] [abbrv] phoenix git commit: PHOENIX-1580 Support UNION ALL

2015-04-16 Thread maryannxue
PHOENIX-1580 Support UNION ALL


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

Branch: refs/heads/calcite
Commit: c50feca254f4c8ae2505d83f738a6ab9d92a9fd9
Parents: c823be9
Author: maryannxue 
Authored: Mon Apr 6 10:46:37 2015 -0400
Committer: maryannxue 
Committed: Mon Apr 6 10:46:37 2015 -0400

--
 .../org/apache/phoenix/end2end/UnionAllIT.java  | 579 +++
 phoenix-core/src/main/antlr3/PhoenixSQL.g   |  48 +-
 .../apache/phoenix/compile/FromCompiler.java|   4 +-
 .../apache/phoenix/compile/QueryCompiler.java   |  65 ++-
 .../phoenix/compile/StatementNormalizer.java|   2 +-
 .../phoenix/compile/SubselectRewriter.java  |   5 +-
 .../apache/phoenix/compile/UnionCompiler.java   |  86 +++
 .../phoenix/exception/SQLExceptionCode.java |   6 +
 .../apache/phoenix/execute/AggregatePlan.java   |   1 +
 .../org/apache/phoenix/execute/UnionPlan.java   | 190 ++
 .../iterate/MergeSortTopNResultIterator.java|   9 +-
 .../phoenix/iterate/UnionResultIterators.java   | 109 
 .../apache/phoenix/jdbc/PhoenixStatement.java   |  25 +-
 .../apache/phoenix/parse/ParseNodeFactory.java  |  39 +-
 .../apache/phoenix/parse/ParseNodeRewriter.java |   5 +-
 .../apache/phoenix/parse/SelectStatement.java   |  30 +-
 .../apache/phoenix/parse/QueryParserTest.java   |  13 -
 17 files changed, 1147 insertions(+), 69 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/c50feca2/phoenix-core/src/it/java/org/apache/phoenix/end2end/UnionAllIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UnionAllIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UnionAllIT.java
new file mode 100644
index 000..b3b2f7d
--- /dev/null
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UnionAllIT.java
@@ -0,0 +1,579 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.phoenix.end2end;
+
+import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
+import java.sql.Statement;
+import java.util.Collections;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.phoenix.exception.SQLExceptionCode;
+import org.apache.phoenix.util.PropertiesUtil;
+import org.apache.phoenix.util.QueryUtil;
+import org.apache.phoenix.util.ReadOnlyProps;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+
+public class UnionAllIT extends BaseOwnClusterHBaseManagedTimeIT {
+
+@BeforeClass
+public static void doSetup() throws Exception {
+Map props = Collections.emptyMap();
+setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator()));
+}
+
+@Test
+public void testUnionAllSelects() throws Exception {
+Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+Connection conn = DriverManager.getConnection(getUrl(), props);
+conn.setAutoCommit(false);
+
+try {
+String ddl = "CREATE TABLE test_table " +
+"  (a_string varchar not null, col1 integer" +
+"  CONSTRAINT pk PRIMARY KEY (a_string))\n";
+createTestTable(getUrl(), ddl);
+
+String dml = "UPSERT INTO test_table VALUES(?, ?)";
+PreparedStatement stmt = conn.prepareStatement(dml);
+stmt.setString(1, "a");
+stmt.setInt(2, 10);
+stmt.execute();

[42/50] [abbrv] phoenix git commit: PHOENIX-1287 Use the joni byte[] regex engine in place of j.u.regex (Shuxiong Ye)

2015-04-16 Thread maryannxue
http://git-wip-us.apache.org/repos/asf/phoenix/blob/3f6b2594/phoenix-core/src/main/java/org/apache/phoenix/parse/RegexpSubstrParseNode.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/parse/RegexpSubstrParseNode.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/parse/RegexpSubstrParseNode.java
new file mode 100644
index 000..a975550
--- /dev/null
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/parse/RegexpSubstrParseNode.java
@@ -0,0 +1,55 @@
+/*
+ * 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.parse;
+
+import java.sql.SQLException;
+import java.util.List;
+
+import org.apache.phoenix.compile.StatementContext;
+import org.apache.phoenix.expression.Expression;
+import org.apache.phoenix.expression.function.ByteBasedRegexpSubstrFunction;
+import org.apache.phoenix.expression.function.RegexpSubstrFunction;
+import org.apache.phoenix.expression.function.StringBasedRegexpSubstrFunction;
+import org.apache.phoenix.query.QueryServices;
+import org.apache.phoenix.query.QueryServicesOptions;
+
+/**
+ * Parse node corresponding to {@link RegexpSubstrFunction}. It also acts as a 
factory for creating
+ * the right kind of RegexpSubstrFunction according to setting in
+ * QueryServices.USE_BYTE_BASED_REGEX_ATTRIB
+ */
+public class RegexpSubstrParseNode extends FunctionParseNode {
+
+RegexpSubstrParseNode(String name, List children, 
BuiltInFunctionInfo info) {
+super(name, children, info);
+}
+
+@Override
+public Expression create(List children, StatementContext 
context)
+throws SQLException {
+QueryServices services = context.getConnection().getQueryServices();
+boolean useByteBasedRegex =
+
services.getProps().getBoolean(QueryServices.USE_BYTE_BASED_REGEX_ATTRIB,
+QueryServicesOptions.DEFAULT_USE_BYTE_BASED_REGEX);
+if (useByteBasedRegex) {
+return new ByteBasedRegexpSubstrFunction(children);
+} else {
+return new StringBasedRegexpSubstrFunction(children);
+}
+}
+}

http://git-wip-us.apache.org/repos/asf/phoenix/blob/3f6b2594/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServices.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServices.java 
b/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServices.java
index adf146d..3c6a6c1 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServices.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServices.java
@@ -50,6 +50,8 @@ public interface QueryServices extends SQLCloseable {
 public static final String AUTO_COMMIT_ATTRIB = 
"phoenix.connection.autoCommit";
 // consistency configuration setting
 public static final String CONSISTENCY_ATTRIB = 
"phoenix.connection.consistency";
+// joni byte regex engine setting
+public static final String USE_BYTE_BASED_REGEX_ATTRIB = 
"phoenix.regex.byteBased";
 
 /**
 * max size to spool the the result into

http://git-wip-us.apache.org/repos/asf/phoenix/blob/3f6b2594/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServicesOptions.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServicesOptions.java 
b/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServicesOptions.java
index 884b820..5cc4fa7 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServicesOptions.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServicesOptions.java
@@ -61,6 +61,7 @@ import static 
org.apache.phoenix.query.QueryServices.STATS_UPDATE_FREQ_MS_ATTRIB
 import static 
org.apache.phoenix.query.QueryServices.STATS_USE_CURRENT_TIME_ATTRIB;
 import static org.apache.phoenix.query.QueryServices.THREAD_POOL_SIZE_ATTRIB;
 import static org.apache.phoenix.query.QueryServices.THREAD_TIMEOUT_MS_ATTRIB;
+import static 
org.apache.phoenix.query.QueryServices.USE_BYTE_BASED_REGEX_ATTRIB;
 import static org.apache.phoenix.qu

[40/50] [abbrv] phoenix git commit: PHOENIX-1705 implement ARRAY_APPEND built in function (Dumindu Buddhika)

2015-04-16 Thread maryannxue
PHOENIX-1705 implement ARRAY_APPEND built in function (Dumindu Buddhika)


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

Branch: refs/heads/calcite
Commit: 986080f3fb939252c01b8c79d0bcdb602e0ddd64
Parents: 1b45110
Author: ramkrishna 
Authored: Tue Apr 14 23:26:22 2015 +0530
Committer: ramkrishna 
Committed: Tue Apr 14 23:26:22 2015 +0530

--
 .../phoenix/expression/ExpressionType.java  |  4 +-
 .../phoenix/schema/types/PArrayDataType.java| 85 
 2 files changed, 88 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/986080f3/phoenix-core/src/main/java/org/apache/phoenix/expression/ExpressionType.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/ExpressionType.java 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/ExpressionType.java
index d562d6a..22778ce 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/ExpressionType.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/ExpressionType.java
@@ -21,6 +21,7 @@ import java.util.Map;
 
 import org.apache.phoenix.expression.function.ArrayAllComparisonExpression;
 import org.apache.phoenix.expression.function.ArrayAnyComparisonExpression;
+import org.apache.phoenix.expression.function.ArrayAppendFunction;
 import org.apache.phoenix.expression.function.ArrayElemRefExpression;
 import org.apache.phoenix.expression.function.ArrayIndexFunction;
 import org.apache.phoenix.expression.function.ArrayLengthFunction;
@@ -211,7 +212,8 @@ public enum ExpressionType {
 NowFunction(NowFunction.class),
 InstrFunction(InstrFunction.class),
 MinuteFunction(MinuteFunction.class),
-DayOfMonthFunction(DayOfMonthFunction.class)
+DayOfMonthFunction(DayOfMonthFunction.class),
+ArrayAppendFunction(ArrayAppendFunction.class)
 ;
 
 ExpressionType(Class clazz) {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/986080f3/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
index c183b7a..b6dce34 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PArrayDataType.java
@@ -456,6 +456,91 @@ public abstract class PArrayDataType extends 
PDataType {
 return null;
 }
 
+public static boolean appendItemToArray(ImmutableBytesWritable ptr, int 
length, int offset, byte[] arrayBytes, PDataType baseType, int arrayLength, 
Integer maxLength, SortOrder sortOrder) {
+int elementLength = maxLength == null ? ptr.getLength() : maxLength;
+
+//padding
+if (elementLength > ptr.getLength()) {
+baseType.pad(ptr, elementLength, sortOrder);
+}
+
+int elementOffset = ptr.getOffset();
+byte[] elementBytes = ptr.get();
+
+byte[] newArray;
+if (!baseType.isFixedWidth()) {
+
+int offsetArrayPosition = Bytes.toInt(arrayBytes, offset + length 
- Bytes.SIZEOF_INT - Bytes.SIZEOF_INT - Bytes.SIZEOF_BYTE, Bytes.SIZEOF_INT);
+int offsetArrayLength = length - offsetArrayPosition - 
Bytes.SIZEOF_INT - Bytes.SIZEOF_INT - Bytes.SIZEOF_BYTE;
+
+//checks whether offset array consists of shorts or integers
+boolean useInt = offsetArrayLength / Math.abs(arrayLength) == 
Bytes.SIZEOF_INT;
+boolean convertToInt = false;
+
+int newElementPosition = offsetArrayPosition - 2 * 
Bytes.SIZEOF_BYTE;
+
+if (!useInt) {
+if (PArrayDataType.useShortForOffsetArray(newElementPosition)) 
{
+newArray = new byte[length + elementLength + 
Bytes.SIZEOF_SHORT + Bytes.SIZEOF_BYTE];
+} else {
+newArray = new byte[length + elementLength + arrayLength * 
Bytes.SIZEOF_SHORT + Bytes.SIZEOF_INT + Bytes.SIZEOF_BYTE];
+convertToInt = true;
+}
+} else {
+newArray = new byte[length + elementLength + Bytes.SIZEOF_INT 
+ Bytes.SIZEOF_BYTE];
+}
+
+int newOffsetArrayPosition = newElementPosition + elementLength + 
3 * Bytes.SIZEOF_BYTE;
+
+System.arraycopy(arrayBytes, offset, newArray, 0, 
newElementPosition);
+System.arraycopy(elementBytes, elementOffset, 

[28/50] [abbrv] phoenix git commit: PHOENIX-1818 - Move cluster-required tests to src/it

2015-04-16 Thread maryannxue
PHOENIX-1818 - Move cluster-required tests to src/it


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

Branch: refs/heads/calcite
Commit: f666baa27ed97cb08ba964c53df74907a53ce001
Parents: 9ddb484
Author: ravimagham 
Authored: Tue Apr 7 00:19:21 2015 -0700
Committer: ravimagham 
Committed: Tue Apr 7 00:19:21 2015 -0700

--
 phoenix-spark/src/it/resources/log4j.xml|  41 +++
 phoenix-spark/src/it/resources/setup.sql|  18 +
 .../apache/phoenix/spark/PhoenixRDDTest.scala   | 333 +++
 phoenix-spark/src/test/resources/log4j.xml  |  41 ---
 phoenix-spark/src/test/resources/setup.sql  |  18 -
 .../apache/phoenix/spark/PhoenixRDDTest.scala   | 333 ---
 6 files changed, 392 insertions(+), 392 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/f666baa2/phoenix-spark/src/it/resources/log4j.xml
--
diff --git a/phoenix-spark/src/it/resources/log4j.xml 
b/phoenix-spark/src/it/resources/log4j.xml
new file mode 100644
index 000..d4799da
--- /dev/null
+++ b/phoenix-spark/src/it/resources/log4j.xml
@@ -0,0 +1,41 @@
+
+
+
+http://jakarta.apache.org/log4j/";>
+  
+
+
+
+  
+
+  
+
+  
+
+  
+
+  
+
+  
+
+  
+
+  
+
+  
+
+  
+
+  
+
+  
+
+  
+
+  
+
+  
+
+
+  
+

http://git-wip-us.apache.org/repos/asf/phoenix/blob/f666baa2/phoenix-spark/src/it/resources/setup.sql
--
diff --git a/phoenix-spark/src/it/resources/setup.sql 
b/phoenix-spark/src/it/resources/setup.sql
new file mode 100644
index 000..14a7e7e
--- /dev/null
+++ b/phoenix-spark/src/it/resources/setup.sql
@@ -0,0 +1,18 @@
+CREATE TABLE table1 (id BIGINT NOT NULL PRIMARY KEY, col1 VARCHAR)
+CREATE TABLE table2 (id BIGINT NOT NULL PRIMARY KEY, table1_id BIGINT, 
"t2col1" VARCHAR)
+UPSERT INTO table1 (id, col1) VALUES (1, 'test_row_1')
+UPSERT INTO table2 (id, table1_id, "t2col1") VALUES (1, 1, 'test_child_1')
+UPSERT INTO table2 (id, table1_id, "t2col1") VALUES (2, 1, 'test_child_2')
+UPSERT INTO table1 (id, col1) VALUES (2, 'test_row_2')
+UPSERT INTO table2 (id, table1_id, "t2col1") VALUES (3, 2, 'test_child_1')
+UPSERT INTO table2 (id, table1_id, "t2col1") VALUES (4, 2, 'test_child_2')
+UPSERT INTO table2 (id, table1_id, "t2col1") VALUES (5, 2, 'test_child_3')
+UPSERT INTO table2 (id, table1_id, "t2col1") VALUES (6, 2, 'test_child_4')
+CREATE TABLE "table3" ("id" BIGINT NOT NULL PRIMARY KEY, "col1" VARCHAR)
+UPSERT INTO "table3" ("id", "col1") VALUES (1, 'foo')
+UPSERT INTO "table3" ("id", "col1") VALUES (2, 'bar')
+CREATE TABLE ARRAY_TEST_TABLE (ID BIGINT NOT NULL PRIMARY KEY, VCARRAY 
VARCHAR[])
+UPSERT INTO ARRAY_TEST_TABLE (ID, VCARRAY) VALUES (1, ARRAY['String1', 
'String2', 'String3'])
+CREATE TABLE DATE_PREDICATE_TEST_TABLE (ID BIGINT NOT NULL, TIMESERIES_KEY 
TIMESTAMP NOT NULL CONSTRAINT pk PRIMARY KEY (ID, TIMESERIES_KEY))
+UPSERT INTO DATE_PREDICATE_TEST_TABLE (ID, TIMESERIES_KEY) VALUES (1, 
CAST(CURRENT_TIME() AS TIMESTAMP))
+CREATE TABLE OUTPUT_TEST_TABLE (id BIGINT NOT NULL PRIMARY KEY, col1 VARCHAR, 
col2 INTEGER, col3 DATE)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/phoenix/blob/f666baa2/phoenix-spark/src/it/scala/org/apache/phoenix/spark/PhoenixRDDTest.scala
--
diff --git 
a/phoenix-spark/src/it/scala/org/apache/phoenix/spark/PhoenixRDDTest.scala 
b/phoenix-spark/src/it/scala/org/apache/phoenix/spark/PhoenixRDDTest.scala
new file mode 100644
index 000..63cb6e4
--- /dev/null
+++ b/phoenix-spark/src/it/scala/org/apache/phoenix/spark/PhoenixRDDTest.scala
@@ -0,0 +1,333 @@
+/*
+   Licensed 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.spark
+
+import java.sql.{Connection, DriverManager}
+import java.util.Date
+
+import org.apache.hadoop.conf.Configuration
+import org.apache.hadoop.hbase.{HConstants, HBaseTestingUtility}
+import org.apache.phoenix.schema.ColumnNotFoundException
+import org.apache.phoenix.schema.types.PVarchar

[25/50] [abbrv] phoenix git commit: PHOENIX-1580 Support UNION ALL

2015-04-16 Thread maryannxue
PHOENIX-1580 Support UNION ALL


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

Branch: refs/heads/calcite
Commit: 5ea3607c7e0603e1e26b7e14ed166ea67818c038
Parents: c50feca
Author: James Taylor 
Authored: Mon Apr 6 11:31:58 2015 -0700
Committer: James Taylor 
Committed: Mon Apr 6 11:31:58 2015 -0700

--
 .../phoenix/iterate/MergeSortTopNResultIterator.java | 11 +--
 1 file changed, 1 insertion(+), 10 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/5ea3607c/phoenix-core/src/main/java/org/apache/phoenix/iterate/MergeSortTopNResultIterator.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/iterate/MergeSortTopNResultIterator.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/MergeSortTopNResultIterator.java
index 87a6a62..4c4097f 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/iterate/MergeSortTopNResultIterator.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/MergeSortTopNResultIterator.java
@@ -31,28 +31,19 @@ import org.apache.phoenix.schema.tuple.Tuple;
  * returning the rows ordered by the OrderByExpression. The input
  * iterators must be ordered by the OrderByExpression.
  *
- * 
- * @since 0.1
  */
 public class MergeSortTopNResultIterator extends MergeSortResultIterator {
 
 private final int limit;
-private final boolean clientSideOnly;
 private int count = 0;
 private final List orderByColumns;
 private final ImmutableBytesWritable ptr1 = new ImmutableBytesWritable();
 private final ImmutableBytesWritable ptr2 = new ImmutableBytesWritable();
 
-public MergeSortTopNResultIterator(ResultIterators iterators, Integer 
limit,
-List orderByColumns, boolean clientSideOnly) {
+public MergeSortTopNResultIterator(ResultIterators iterators, Integer 
limit, List orderByColumns) {
 super(iterators);
 this.limit = limit == null ? -1 : limit;
 this.orderByColumns = orderByColumns;
-this.clientSideOnly = clientSideOnly;
-}
-
-public MergeSortTopNResultIterator(ResultIterators iterators, Integer 
limit, List orderByColumns) {
-this(iterators, limit, orderByColumns, false);
 }
 
 @Override



[39/50] [abbrv] phoenix git commit: PHOENIX-1861 Padding character should be inverted if sort order is descending (Dumindu Buddhika)

2015-04-16 Thread maryannxue
PHOENIX-1861 Padding character should be inverted if sort order is
descending (Dumindu Buddhika)


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

Branch: refs/heads/calcite
Commit: 1b45110db66cbe40871aeea6025aef5ff7ef2682
Parents: 0d78e48
Author: ramkrishna 
Authored: Tue Apr 14 23:23:49 2015 +0530
Committer: ramkrishna 
Committed: Tue Apr 14 23:23:49 2015 +0530

--
 .../src/main/java/org/apache/phoenix/compile/WhereOptimizer.java | 2 +-
 .../src/main/java/org/apache/phoenix/schema/PTableImpl.java  | 2 +-
 .../src/main/java/org/apache/phoenix/schema/types/PBinary.java   | 2 +-
 .../src/main/java/org/apache/phoenix/schema/types/PChar.java | 4 ++--
 .../src/main/java/org/apache/phoenix/schema/types/PDataType.java | 2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/1b45110d/phoenix-core/src/main/java/org/apache/phoenix/compile/WhereOptimizer.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/compile/WhereOptimizer.java 
b/phoenix-core/src/main/java/org/apache/phoenix/compile/WhereOptimizer.java
index b03793d..e25cfbc 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/compile/WhereOptimizer.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/WhereOptimizer.java
@@ -1210,7 +1210,7 @@ public class WhereOptimizer {
 Integer length = getColumn().getMaxLength();
 if (length != null) {
 // Go through type to pad as the fill character 
depends on the type.
-type.pad(ptr, length);
+type.pad(ptr, length, SortOrder.getDefault());
 }
 }
 byte[] key = ByteUtil.copyKeyBytesIfNecessary(ptr);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/1b45110d/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java
index 8ce4183..702edbd 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java
@@ -703,7 +703,7 @@ public class PTableImpl implements PTable {
 IntegermaxLength = column.getMaxLength();
if (!isNull && type.isFixedWidth() && maxLength != null) {
if (ptr.getLength() <= maxLength) {
-type.pad(ptr, maxLength);
+type.pad(ptr, maxLength, SortOrder.getDefault());
 } else if (ptr.getLength() > maxLength) {
 throw new 
DataExceedsCapacityException(name.getString() + "." + 
column.getName().getString() + " may not exceed " + maxLength + " bytes (" + 
type.toObject(byteValue) + ")");
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/1b45110d/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PBinary.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PBinary.java 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PBinary.java
index 25604a3..d6d07fd 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PBinary.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PBinary.java
@@ -35,7 +35,7 @@ public class PBinary extends PDataType {
   }
 
   @Override
-  public void pad(ImmutableBytesWritable ptr, Integer maxLength) {
+  public void pad(ImmutableBytesWritable ptr, Integer maxLength, SortOrder 
sortOrder) {
 if (ptr.getLength() >= maxLength) {
   return;
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/1b45110d/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PChar.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PChar.java 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PChar.java
index 48d47d3..2effc38 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PChar.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PChar.java
@@ -41,13 +41,13 @@ public class PChar extends PDataType {
   }
 
 @Override
-public void pad(ImmutableBytesWritable ptr, Integer maxLength) {
+public void pad(ImmutableByte

[29/50] [abbrv] phoenix git commit: PHOENIX-1755 Improve error logging if csv line has insufficient fields

2015-04-16 Thread maryannxue
PHOENIX-1755 Improve error logging if csv line has insufficient fields

Signed-off-by: Gabriel Reid 


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

Branch: refs/heads/calcite
Commit: ff0e8e4edceb5847a2eeb86500f4784525881d6d
Parents: f666baa
Author: Karel Vervaeke 
Authored: Thu Mar 19 16:10:07 2015 +0100
Committer: Gabriel Reid 
Committed: Tue Apr 7 21:15:09 2015 +0200

--
 .../java/org/apache/phoenix/util/csv/CsvUpsertExecutor.java | 5 +
 1 file changed, 5 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/ff0e8e4e/phoenix-core/src/main/java/org/apache/phoenix/util/csv/CsvUpsertExecutor.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/util/csv/CsvUpsertExecutor.java 
b/phoenix-core/src/main/java/org/apache/phoenix/util/csv/CsvUpsertExecutor.java
index b5f6f9f..0e3294b 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/util/csv/CsvUpsertExecutor.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/util/csv/CsvUpsertExecutor.java
@@ -144,6 +144,11 @@ public class CsvUpsertExecutor implements Closeable {
  */
 void execute(CSVRecord csvRecord) {
 try {
+if (csvRecord.size() < conversionFunctions.size()) {
+String message = String.format("CSV record does not have 
enough values (has %d, but needs %d)",
+csvRecord.size(), conversionFunctions.size());
+throw new IllegalArgumentException(message);
+}
 for (int fieldIndex = 0; fieldIndex < conversionFunctions.size(); 
fieldIndex++) {
 Object sqlValue = 
conversionFunctions.get(fieldIndex).apply(csvRecord.get(fieldIndex));
 if (sqlValue != null) {



[49/50] [abbrv] phoenix git commit: PHOENIX-1815 - Spark Datasource api

2015-04-16 Thread maryannxue
PHOENIX-1815 - Spark Datasource api


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

Branch: refs/heads/calcite
Commit: 3fb3bb4d2231972dc06326251b76cc1431da7386
Parents: e1bbb94
Author: ravimagham 
Authored: Wed Apr 15 19:03:33 2015 -0700
Committer: ravimagham 
Committed: Wed Apr 15 19:03:33 2015 -0700

--
 phoenix-assembly/pom.xml|   6 +-
 .../src/build/components/all-common-jars.xml|  11 ++
 phoenix-spark/README.md |  74 --
 phoenix-spark/pom.xml   |   6 -
 phoenix-spark/src/it/resources/setup.sql|   1 +
 .../apache/phoenix/spark/PhoenixSparkIT.scala   | 135 ---
 .../phoenix/spark/ConfigurationUtil.scala   |  65 +
 .../phoenix/spark/DataFrameFunctions.scala  |  51 +++
 .../apache/phoenix/spark/DefaultSource.scala|  41 ++
 .../org/apache/phoenix/spark/PhoenixRDD.scala   |  12 +-
 .../phoenix/spark/PhoenixRecordWritable.scala   |   2 +-
 .../apache/phoenix/spark/PhoenixRelation.scala  |  80 +++
 .../phoenix/spark/ProductRDDFunctions.scala |  21 +--
 .../org/apache/phoenix/spark/package.scala  |   6 +-
 pom.xml |   5 +
 15 files changed, 453 insertions(+), 63 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/3fb3bb4d/phoenix-assembly/pom.xml
--
diff --git a/phoenix-assembly/pom.xml b/phoenix-assembly/pom.xml
index 51f767f..b3a992e 100644
--- a/phoenix-assembly/pom.xml
+++ b/phoenix-assembly/pom.xml
@@ -142,9 +142,13 @@
   org.apache.phoenix
   phoenix-flume
 
-
+
   org.apache.phoenix
   phoenix-pig
 
+
+  org.apache.phoenix
+  phoenix-spark
+
   
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/3fb3bb4d/phoenix-assembly/src/build/components/all-common-jars.xml
--
diff --git a/phoenix-assembly/src/build/components/all-common-jars.xml 
b/phoenix-assembly/src/build/components/all-common-jars.xml
index ce6da59..769e28f 100644
--- a/phoenix-assembly/src/build/components/all-common-jars.xml
+++ b/phoenix-assembly/src/build/components/all-common-jars.xml
@@ -71,5 +71,16 @@
   
   0644
 
+
+  ${project.basedir}/../phoenix-spark/target/
+  lib
+  
+  phoenix-*.jar
+  
+  
+  
+  
+  0644
+
   
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/3fb3bb4d/phoenix-spark/README.md
--
diff --git a/phoenix-spark/README.md b/phoenix-spark/README.md
index 1c030f8..1e53c98 100644
--- a/phoenix-spark/README.md
+++ b/phoenix-spark/README.md
@@ -11,7 +11,7 @@ UPSERT INTO TABLE1 (ID, COL1) VALUES (1, 'test_row_1');
 UPSERT INTO TABLE1 (ID, COL1) VALUES (2, 'test_row_2');
 ```
 
-### Load as a DataFrame
+### Load as a DataFrame using the Data Source API
 ```scala
 import org.apache.spark.SparkContext
 import org.apache.spark.sql.SQLContext
@@ -20,15 +20,39 @@ import org.apache.phoenix.spark._
 val sc = new SparkContext("local", "phoenix-test")
 val sqlContext = new SQLContext(sc)
 
+val df = sqlContext.load(
+  "org.apache.phoenix.spark", 
+  Map("table" -> "TABLE1", "zkUrl" -> "phoenix-server:2181")
+)
+
+df
+  .filter(df("COL1") === "test_row_1" && df("ID") === 1L)
+  .select(df("ID"))
+  .show
+```
+
+### Load as a DataFrame directly using a Configuration object
+```scala
+import org.apache.hadoop.conf.Configuration
+import org.apache.spark.SparkContext
+import org.apache.spark.sql.SQLContext
+import org.apache.phoenix.spark._
+
+val configuration = new Configuration()
+// Can set Phoenix-specific settings, requires 'hbase.zookeeper.quorum'
+
+val sc = new SparkContext("local", "phoenix-test")
+val sqlContext = new SQLContext(sc)
+
 // Load the columns 'ID' and 'COL1' from TABLE1 as a DataFrame
 val df = sqlContext.phoenixTableAsDataFrame(
-  "TABLE1", Array("ID", "COL1"), zkUrl = Some("phoenix-server:2181")
+  "TABLE1", Array("ID", "COL1"), conf = configuration
 )
 
 df.show
 ```
 
-### Load as an RDD
+### Load as an RDD, using a Zookeeper URL
 ```scala
 import org.apache.spark.SparkContext
 import org.apache.spark.sql.SQLContext
@@ -47,7 +71,10 @@ val firstId = rdd1.first()("ID").asInstanceOf[Long]
 val firstCol = rdd1.first()("COL1").asInstanceOf[String]
 ```
 
-## Saving RDDs to Phoenix
+## Saving RDDs to Phoenix 
+
+`saveToPhoenix` is an implicit method on RDD[Product], or an RDD of Tuples. 
The data types must
+correspond to the Java types 

[35/50] [abbrv] phoenix git commit: PHOENIX-1826 Implement TrackOrderPreservingExpressionCompiler as Expression visitor instead of ParseNode visitor

2015-04-16 Thread maryannxue
PHOENIX-1826 Implement TrackOrderPreservingExpressionCompiler as Expression 
visitor instead of ParseNode visitor


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

Branch: refs/heads/calcite
Commit: 2f0b51cbe8db817471d87d2521508ba6e42174e9
Parents: 795debf
Author: James Taylor 
Authored: Mon Apr 13 16:27:20 2015 -0700
Committer: James Taylor 
Committed: Mon Apr 13 16:27:20 2015 -0700

--
 .../apache/phoenix/end2end/DerivedTableIT.java  |   4 +-
 .../org/apache/phoenix/end2end/HashJoinIT.java  |   7 -
 .../org/apache/phoenix/end2end/OrderByIT.java   |  13 +-
 .../org/apache/phoenix/end2end/SubqueryIT.java  |   8 +-
 .../end2end/SubqueryUsingSortMergeJoinIT.java   |  20 +-
 .../phoenix/end2end/VariableLengthPKIT.java |   2 +-
 .../index/GlobalIndexOptimizationIT.java|  11 +-
 .../apache/phoenix/compile/GroupByCompiler.java |  56 ++--
 .../apache/phoenix/compile/OrderByCompiler.java |  46 ++--
 .../phoenix/compile/OrderPreservingTracker.java | 259 +++
 .../TrackOrderPreservingExpressionCompiler.java | 249 --
 .../phoenix/compile/QueryCompilerTest.java  | 108 +++-
 .../phoenix/compile/QueryOptimizerTest.java |   7 +-
 13 files changed, 441 insertions(+), 349 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/2f0b51cb/phoenix-core/src/it/java/org/apache/phoenix/end2end/DerivedTableIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DerivedTableIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DerivedTableIT.java
index 7443267..b7c4906 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DerivedTableIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DerivedTableIT.java
@@ -309,8 +309,8 @@ public class DerivedTableIT extends BaseClientManagedTimeIT 
{
 rs = conn.createStatement().executeQuery("EXPLAIN " + query);
 assertEquals(plans[0], QueryUtil.getExplainPlan(rs));
 
-// distinct b (groupby b, a) groupby a
-query = "SELECT DISTINCT COLLECTDISTINCT(t.b) FROM (SELECT 
b_string b, a_string a FROM aTable GROUP BY b_string, a_string) AS t GROUP BY 
t.a";
+// distinct b (groupby a, b) groupby a
+query = "SELECT DISTINCT COLLECTDISTINCT(t.b) FROM (SELECT 
b_string b, a_string a FROM aTable GROUP BY a_string, b_string) AS t GROUP BY 
t.a";
 statement = conn.prepareStatement(query);
 rs = statement.executeQuery();
 assertTrue (rs.next());

http://git-wip-us.apache.org/repos/asf/phoenix/blob/2f0b51cb/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java
index 1a2a1d0..a03204a 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java
@@ -118,7 +118,6 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT {
 "CLIENT PARALLEL 1-WAY FULL SCAN OVER " + 
JOIN_ORDER_TABLE_DISPLAY_NAME + "\n" +
 "SERVER AGGREGATE INTO DISTINCT ROWS BY [I.NAME]\n" +
 "CLIENT MERGE SORT\n" +
-"CLIENT SORTED BY [I.NAME]\n" +
 "PARALLEL LEFT-JOIN TABLE 0\n" +
 "CLIENT PARALLEL 1-WAY FULL SCAN OVER " + 
JOIN_ITEM_TABLE_DISPLAY_NAME,
 /* 
@@ -156,7 +155,6 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT {
 "CLIENT PARALLEL 1-WAY FULL SCAN OVER " + 
JOIN_ITEM_TABLE_DISPLAY_NAME + "\n" +
 "SERVER AGGREGATE INTO DISTINCT ROWS BY [I.NAME]\n" +
 "CLIENT MERGE SORT\n" +
-"CLIENT SORTED BY [I.NAME]\n" +
 "PARALLEL LEFT-JOIN TABLE 0\n" +
 "CLIENT PARALLEL 1-WAY FULL SCAN OVER " + 
JOIN_ORDER_TABLE_DISPLAY_NAME,
 /*
@@ -307,7 +305,6 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT {
 "CLIENT PARALLEL 1-WAY FULL SCAN OVER " + 
JOIN_ORDER_TABLE_DISPLAY_NAME + "\n" +
 "SERVER AGGREGATE INTO DISTINCT ROWS BY [I.NAME]\n" +
 "CLIENT MERGE SORT\n" +
-"CLIENT SORTED BY [I.NAME]\n" +
 "PARALLEL LEFT-JOIN TABLE 0\n" +
 "CLIENT PARALLEL 1-WAY FULL SCAN OVER " + 
JOIN_ITEM_TABLE_DISPLAY_NAME,

[19/50] [abbrv] phoenix git commit: PHOENIX-1803 Fix flapping PhoenixServerRpcIT.testMetadataQos

2015-04-16 Thread maryannxue
PHOENIX-1803 Fix flapping PhoenixServerRpcIT.testMetadataQos


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

Branch: refs/heads/calcite
Commit: 3a0ce7d0f31bddc1ea802d66dde91bdde0e01504
Parents: eb73271
Author: Thomas D'Silva 
Authored: Thu Apr 2 17:50:58 2015 -0700
Committer: Thomas D'Silva 
Committed: Thu Apr 2 17:56:37 2015 -0700

--
 .../src/it/java/org/apache/phoenix/rpc/PhoenixServerRpcIT.java   | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/3a0ce7d0/phoenix-core/src/it/java/org/apache/phoenix/rpc/PhoenixServerRpcIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/rpc/PhoenixServerRpcIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/rpc/PhoenixServerRpcIT.java
index dbcd7ac..4d3620f 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/rpc/PhoenixServerRpcIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/rpc/PhoenixServerRpcIT.java
@@ -221,8 +221,8 @@ public class PhoenixServerRpcIT extends 
BaseOwnClusterHBaseManagedTimeIT {
 "CREATE TABLE " + DATA_TABLE_FULL_NAME + " (k VARCHAR NOT 
NULL PRIMARY KEY, v VARCHAR)");
 // query the table from another connection, so that SYSTEM.STATS 
will be used 
 conn.createStatement().execute("SELECT * FROM 
"+DATA_TABLE_FULL_NAME);
-// verify that that metadata queue is used once 
-
Mockito.verify(TestPhoenixIndexRpcSchedulerFactory.getMetadataRpcExecutor()).dispatch(Mockito.any(CallRunner.class));
+// verify that that metadata queue is at least once 
+
Mockito.verify(TestPhoenixIndexRpcSchedulerFactory.getMetadataRpcExecutor(), 
Mockito.atLeastOnce()).dispatch(Mockito.any(CallRunner.class));
 }
 finally {
 conn.close();



[47/50] [abbrv] phoenix git commit: PHOENIX-1814 Exponential notation parsing and tests

2015-04-16 Thread maryannxue
PHOENIX-1814 Exponential notation parsing and tests


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

Branch: refs/heads/calcite
Commit: d147423137af487c0582234c12cc00b0e8f6be98
Parents: 007361b
Author: Brian 
Authored: Tue Apr 14 13:49:24 2015 -0700
Committer: Thomas D'Silva 
Committed: Wed Apr 15 11:09:12 2015 -0700

--
 .../phoenix/end2end/ArithmeticQueryIT.java  | 60 
 phoenix-core/src/main/antlr3/PhoenixSQL.g   | 16 +-
 2 files changed, 74 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/d1474231/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArithmeticQueryIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArithmeticQueryIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArithmeticQueryIT.java
index 72eb016..f56c965 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArithmeticQueryIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArithmeticQueryIT.java
@@ -985,4 +985,64 @@ public class ArithmeticQueryIT extends 
BaseHBaseManagedTimeIT {
 assertTrue(rs.next());
 assertEquals(-1.0f, rs.getFloat(1), 0.001);
 }
+
+@Test
+public void testSystemTableHasDoubleForExponentialNumber() throws 
Exception {
+Connection conn = DriverManager.getConnection(getUrl());
+String ddl = "CREATE TABLE test (id VARCHAR not null primary key, num 
FLOAT)";
+conn.createStatement().execute(ddl);
+String dml = "UPSERT INTO test(id,num) VALUES ('testid', 1.2E3)";
+conn.createStatement().execute(dml);
+conn.commit();
+
+ResultSet rs = conn.createStatement().executeQuery("SELECT 1.2E3 FROM 
SYSTEM.CATALOG LIMIT 1");
+assertTrue(rs.next());
+assertTrue(rs.getObject(1) instanceof Double);
+}
+
+@Test
+public void testFloatingPointWithExponentialNotation() throws Exception {
+   Float[] expected = {1.5E7f, 1.5E-7f, -1.5E-7f, 12E-5f, -.12E+34f};
+   String[] values = {"1.5e7", "1.5e-7", "-1.5e-7", "12E-5", "-.12E+34"};
+ResultSet rs = createTableWithValues(values, "FLOAT");
+for (int i = 0; i < expected.length; i++) {
+   assertEquals(expected[i], rs.getFloat(i+1), 0.001);
+}
+}
+
+@Test
+public void testDoubleWithExponentialNotation() throws Exception {
+   Double[] expected = {1.5E7d, 1.5E-7d, -1.5E-7d, 12E-5d, -.654E-321d, 
.1234E+56d};
+   String[] values = {"1.5e7", "1.5e-7", "-1.5e-7", "12E-5", "-.654E-321", 
".1234E+56"};
+   ResultSet rs = createTableWithValues(values, "DOUBLE");
+for (int i = 0; i < expected.length; i++) {
+   assertEquals(expected[i], rs.getDouble(i+1), 0.001);
+}
+}
+
+private ResultSet createTableWithValues(String[] values, String valueType) 
throws SQLException {
+   Connection conn = DriverManager.getConnection(getUrl());
+StringBuilder ddl = new StringBuilder("CREATE TABLE test (id VARCHAR 
not null primary key");
+StringBuilder dmll = new StringBuilder("UPSERT INTO test(id,");
+StringBuilder dmlr = new StringBuilder(") VALUES ('testid'");
+StringBuilder select = new StringBuilder("SELECT");
+for(int i = 0; i < values.length; i++) {
+   ddl.append(", num").append(i).append(" ").append(valueType);
+   dmll.append("num").append(i).append(",");
+   dmlr.append(", ").append(values[i]);
+   select.append(" num").append(i).append(",");
+}
+ddl.append(")");
+dmlr.append(")");
+dmll.deleteCharAt(dmll.length()-1);
+select.deleteCharAt(select.length()-1);
+select.append(" FROM test");
+conn.createStatement().execute(ddl.toString());
+conn.createStatement().execute(dmll.toString() + dmlr.toString());
+conn.commit();
+
+ResultSet rs = conn.createStatement().executeQuery(select.toString());
+rs.next();
+return rs;
+}
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d1474231/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 9f60424..f57c5cc 100644
--- a/phoenix-core/src/main/antlr3/PhoenixSQL.g
+++ b/phoenix-core/src/main/antlr3/PhoenixSQL.g
@@ -903,6 +903,9 @@ literal returns [LiteralParseNode ret]
 |   d=DECIMAL  {
 ret = factory

[44/50] [abbrv] phoenix git commit: PHOENIX-1861 Padding character should be inverted if sort order is descending (Dumindu Buddhika)

2015-04-16 Thread maryannxue
PHOENIX-1861 Padding character should be inverted if sort order is descending 
(Dumindu Buddhika)


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

Branch: refs/heads/calcite
Commit: b0c28a2de9b8b2807abaeddf1ec5430cc9f13c61
Parents: 3f6b259
Author: James Taylor 
Authored: Tue Apr 14 12:26:09 2015 -0700
Committer: James Taylor 
Committed: Tue Apr 14 12:26:09 2015 -0700

--
 .../src/main/java/org/apache/phoenix/compile/WhereOptimizer.java   | 2 +-
 .../src/main/java/org/apache/phoenix/schema/PTableImpl.java| 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/b0c28a2d/phoenix-core/src/main/java/org/apache/phoenix/compile/WhereOptimizer.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/compile/WhereOptimizer.java 
b/phoenix-core/src/main/java/org/apache/phoenix/compile/WhereOptimizer.java
index e25cfbc..a5aef02 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/compile/WhereOptimizer.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/WhereOptimizer.java
@@ -1210,7 +1210,7 @@ public class WhereOptimizer {
 Integer length = getColumn().getMaxLength();
 if (length != null) {
 // Go through type to pad as the fill character 
depends on the type.
-type.pad(ptr, length, SortOrder.getDefault());
+type.pad(ptr, length, getColumn().getSortOrder());
 }
 }
 byte[] key = ByteUtil.copyKeyBytesIfNecessary(ptr);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/b0c28a2d/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java
index 702edbd..088595b 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java
@@ -703,7 +703,7 @@ public class PTableImpl implements PTable {
 IntegermaxLength = column.getMaxLength();
if (!isNull && type.isFixedWidth() && maxLength != null) {
if (ptr.getLength() <= maxLength) {
-type.pad(ptr, maxLength, SortOrder.getDefault());
+type.pad(ptr, maxLength, column.getSortOrder());
 } else if (ptr.getLength() > maxLength) {
 throw new 
DataExceedsCapacityException(name.getString() + "." + 
column.getName().getString() + " may not exceed " + maxLength + " bytes (" + 
type.toObject(byteValue) + ")");
 }



[48/50] [abbrv] phoenix git commit: PHOENIX-1865 Fix missing ASL headers

2015-04-16 Thread maryannxue
PHOENIX-1865 Fix missing ASL headers


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

Branch: refs/heads/calcite
Commit: e1bbb944126da52d14bf5df580167644a1cd8499
Parents: d147423
Author: Nick Dimiduk 
Authored: Tue Apr 14 16:28:26 2015 -0700
Committer: Nick Dimiduk 
Committed: Wed Apr 15 16:48:57 2015 -0700

--
 .../expression/function/RandomFunction.java | 17 +++
 .../test/resources/datamodel/test_schema.sql| 16 ++
 phoenix-protocol/src/main/PGuidePosts.proto | 20 ++
 phoenix-spark/pom.xml   | 22 
 phoenix-spark/src/it/resources/log4j.xml| 21 +++
 phoenix-spark/src/it/resources/setup.sql| 16 ++
 pom.xml |  2 ++
 7 files changed, 114 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/e1bbb944/phoenix-core/src/main/java/org/apache/phoenix/expression/function/RandomFunction.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/RandomFunction.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/RandomFunction.java
index 535a127..01a4eed 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/RandomFunction.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/RandomFunction.java
@@ -1,3 +1,20 @@
+/*
+ * 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.expression.function;
 
 import java.io.DataInput;

http://git-wip-us.apache.org/repos/asf/phoenix/blob/e1bbb944/phoenix-pherf/src/test/resources/datamodel/test_schema.sql
--
diff --git a/phoenix-pherf/src/test/resources/datamodel/test_schema.sql 
b/phoenix-pherf/src/test/resources/datamodel/test_schema.sql
index 498f832..8f16675 100644
--- a/phoenix-pherf/src/test/resources/datamodel/test_schema.sql
+++ b/phoenix-pherf/src/test/resources/datamodel/test_schema.sql
@@ -1,3 +1,19 @@
+-- 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.
+
 CREATE TABLE IF NOT EXISTS PHERF.TEST_TABLE (
 TENANT_ID CHAR(15) NOT NULL,
 PARENT_ID CHAR(15) NOT NULL,

http://git-wip-us.apache.org/repos/asf/phoenix/blob/e1bbb944/phoenix-protocol/src/main/PGuidePosts.proto
--
diff --git a/phoenix-protocol/src/main/PGuidePosts.proto 
b/phoenix-protocol/src/main/PGuidePosts.proto
index 1550391..047a658 100644
--- a/phoenix-protocol/src/main/PGuidePosts.proto
+++ b/phoenix-protocol/src/main/PGuidePosts.proto
@@ -1,3 +1,23 @@
+/*
+ * Copyright 2010 The Apache Software Foundation
+ *
+ * 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 exc

[08/50] [abbrv] phoenix git commit: PHOENIX-1783 Fix IDE compiler errors for JodaTimezoneCacheTest

2015-04-16 Thread maryannxue
PHOENIX-1783 Fix IDE compiler errors for JodaTimezoneCacheTest


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

Branch: refs/heads/calcite
Commit: 2c0ed1045c84375a09e21e6f39ff96b48fd4e519
Parents: b9002b7
Author: James Taylor 
Authored: Fri Mar 27 16:29:00 2015 -0700
Committer: James Taylor 
Committed: Fri Mar 27 16:29:00 2015 -0700

--
 .../org/apache/phoenix/cache/JodaTimezoneCacheTest.java   | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/2c0ed104/phoenix-core/src/test/java/org/apache/phoenix/cache/JodaTimezoneCacheTest.java
--
diff --git 
a/phoenix-core/src/test/java/org/apache/phoenix/cache/JodaTimezoneCacheTest.java
 
b/phoenix-core/src/test/java/org/apache/phoenix/cache/JodaTimezoneCacheTest.java
index f388703..e9b6c67 100644
--- 
a/phoenix-core/src/test/java/org/apache/phoenix/cache/JodaTimezoneCacheTest.java
+++ 
b/phoenix-core/src/test/java/org/apache/phoenix/cache/JodaTimezoneCacheTest.java
@@ -15,12 +15,14 @@
  */
 package org.apache.phoenix.cache;
 
+import static org.junit.Assert.assertNotNull;
+
 import java.nio.ByteBuffer;
+
 import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.phoenix.schema.IllegalDataException;
 import org.joda.time.DateTimeZone;
-import static org.junit.Assert.assertTrue;
 import org.junit.Test;
 
 public class JodaTimezoneCacheTest {
@@ -28,13 +30,13 @@ public class JodaTimezoneCacheTest {
 @Test
 public void testGetInstanceByteBufferUTC() {
 DateTimeZone instance = 
JodaTimezoneCache.getInstance(ByteBuffer.wrap(Bytes.toBytes("UTC")));
-assertTrue(instance instanceof DateTimeZone);
+assertNotNull(instance);
 }
 
 @Test
 public void testGetInstanceString() {
 DateTimeZone instance = 
JodaTimezoneCache.getInstance("America/St_Vincent");
-assertTrue(instance instanceof DateTimeZone);
+assertNotNull(instance);
 }
 
 @Test(expected = IllegalDataException.class)
@@ -46,6 +48,6 @@ public class JodaTimezoneCacheTest {
 public void testGetInstanceImmutableBytesWritable() {
 ImmutableBytesWritable ptr = new 
ImmutableBytesWritable(Bytes.toBytes("Europe/Isle_of_Man"));
 DateTimeZone instance = JodaTimezoneCache.getInstance(ptr);
-assertTrue(instance instanceof DateTimeZone);
+assertNotNull(instance);
 }
 }



[05/50] [abbrv] phoenix git commit: PHOENIX-1457 Use high priority queue for metadata endpoint calls

2015-04-16 Thread maryannxue
http://git-wip-us.apache.org/repos/asf/phoenix/blob/a7d7dfb5/phoenix-core/src/test/java/org/apache/hadoop/hbase/regionserver/PhoenixIndexRpcSchedulerFactoryTest.java
--
diff --git 
a/phoenix-core/src/test/java/org/apache/hadoop/hbase/regionserver/PhoenixIndexRpcSchedulerFactoryTest.java
 
b/phoenix-core/src/test/java/org/apache/hadoop/hbase/regionserver/PhoenixIndexRpcSchedulerFactoryTest.java
deleted file mode 100644
index 7d08c0d..000
--- 
a/phoenix-core/src/test/java/org/apache/hadoop/hbase/regionserver/PhoenixIndexRpcSchedulerFactoryTest.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.hbase.regionserver;
-
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.phoenix.hbase.index.ipc.PhoenixIndexRpcSchedulerFactory;
-import org.apache.phoenix.query.QueryServices;
-import org.junit.Test;
-
-public class PhoenixIndexRpcSchedulerFactoryTest {
-
-@Test
-public void ensureInstantiation() throws Exception {
-Configuration conf = new Configuration(false);
-conf.setClass(RSRpcServices.REGION_SERVER_RPC_SCHEDULER_FACTORY_CLASS,
-PhoenixIndexRpcSchedulerFactory.class, RpcSchedulerFactory.class);
-// kinda lame that we copy the copy from the regionserver to do this 
and can't use a static
-// method, but meh
-try {
-Class rpcSchedulerFactoryClass =
-
conf.getClass(RSRpcServices.REGION_SERVER_RPC_SCHEDULER_FACTORY_CLASS,
-SimpleRpcSchedulerFactory.class);
-Object o = rpcSchedulerFactoryClass.newInstance();
-assertTrue(o instanceof PhoenixIndexRpcSchedulerFactory);
-} catch (InstantiationException e) {
-assertTrue("Should not have got an exception when instantiing the 
rpc scheduler: " + e,
-false);
-} catch (IllegalAccessException e) {
-assertTrue("Should not have got an exception when instantiing the 
rpc scheduler: " + e,
-false);
-}
-}
-
-/**
- * Ensure that we can't configure the index priority ranges inside the 
hbase ranges
- * @throws Exception
- */
-@Test
-public void testValidateIndexPriorityRanges() throws Exception {
-Configuration conf = new Configuration(false);
-// standard configs should be fine
-PhoenixIndexRpcSchedulerFactory factory = new 
PhoenixIndexRpcSchedulerFactory();
-factory.create(conf, null);
-
-setMinMax(conf, 0, 4);
-factory.create(conf, null);
-
-setMinMax(conf, 201, 202);
-factory.create(conf, null);
-
-setMinMax(conf, 102, 101);
-try {
-factory.create(conf, null);
-fail("Should not have allowed max less than min");
-} catch (IllegalArgumentException e) {
-// expected
-}
-
-setMinMax(conf, 5, 6);
-try {
-factory.create(conf, null);
-fail("Should not have allowed min in range");
-} catch (IllegalArgumentException e) {
-// expected
-}
-
-setMinMax(conf, 6, 60);
-try {
-factory.create(conf, null);
-fail("Should not have allowed min/max in hbase range");
-} catch (IllegalArgumentException e) {
-// expected
-}
-
-setMinMax(conf, 6, 101);
-try {
-factory.create(conf, null);
-fail("Should not have allowed in range");
-} catch (IllegalArgumentException e) {
-// expected
-}
-}
-
-private void setMinMax(Configuration conf, int min, int max) {
-conf.setInt(QueryServices.MIN_INDEX_PRIOIRTY_ATTRIB, min);
-conf.setInt(QueryServices.MAX_INDEX_PRIOIRTY_ATTRIB, max);
-}
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/phoenix/blob/a7d7dfb5/phoenix-core/src/test/java/org/apache/hadoop/hbase/regionserver/PhoenixRpcSchedulerFactoryTest.java
--

[14/50] [abbrv] phoenix git commit: PHOENIX-1800 Fix failing test case SaltedViewIT#testSaltedUpdatableViewWithLocalIndex(Rajeshbabu Chintaguntla)

2015-04-16 Thread maryannxue
PHOENIX-1800 Fix failing test case 
SaltedViewIT#testSaltedUpdatableViewWithLocalIndex(Rajeshbabu Chintaguntla)


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

Branch: refs/heads/calcite
Commit: 1e280617c25f31658ab7c5a68de62438458a94e5
Parents: 13d6296
Author: Rajeshbabu Chintaguntla 
Authored: Thu Apr 2 19:26:51 2015 +0530
Committer: Rajeshbabu Chintaguntla 
Committed: Thu Apr 2 19:26:51 2015 +0530

--
 .../src/main/java/org/apache/phoenix/util/IndexUtil.java | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/1e280617/phoenix-core/src/main/java/org/apache/phoenix/util/IndexUtil.java
--
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/IndexUtil.java 
b/phoenix-core/src/main/java/org/apache/phoenix/util/IndexUtil.java
index 10ca305..ca25348 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/IndexUtil.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/IndexUtil.java
@@ -483,12 +483,12 @@ public class IndexUtil {
 if (dataRegion != null) {
 joinResult = dataRegion.get(get);
 } else {
-TableName indexTable =
-
TableName.valueOf(MetaDataUtil.getLocalIndexPhysicalName(c.getEnvironment()
-.getRegion().getTableDesc().getName()));
+TableName dataTable =
+
TableName.valueOf(MetaDataUtil.getUserTableName(c.getEnvironment()
+
.getRegion().getTableDesc().getNameAsString()));
 HTableInterface table = null;
 try {
-table = c.getEnvironment().getTable(indexTable);
+table = c.getEnvironment().getTable(dataTable);
 joinResult = table.get(get);
 } finally {
 if (table != null) table.close();



[04/50] [abbrv] phoenix git commit: Fix IndexExpressionIT test failures

2015-04-16 Thread maryannxue
Fix IndexExpressionIT test failures


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

Branch: refs/heads/calcite
Commit: b256fde0eab4813372c085491fdb845336dd0074
Parents: 1a13784
Author: Thomas D'Silva 
Authored: Thu Mar 26 12:24:46 2015 -0700
Committer: Thomas D'Silva 
Committed: Thu Mar 26 12:24:46 2015 -0700

--
 .../java/org/apache/phoenix/end2end/index/IndexExpressionIT.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/b256fde0/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexExpressionIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexExpressionIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexExpressionIT.java
index 0203e35..1a5fbcc 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexExpressionIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexExpressionIT.java
@@ -480,7 +480,7 @@ public class IndexExpressionIT extends 
BaseHBaseManagedTimeIT {
 String expectedPlan = "CLIENT PARALLEL 1-WAY "
 + (localIndex ? "RANGE SCAN OVER _LOCAL_IDX_" + 
fullDataTableName + " [-32768]"
 : "FULL SCAN OVER INDEX_TEST.IDX")
-+ "\nSERVER FILTER BY FIRST KEY ONLY\nSERVER 
AGGREGATE INTO ORDERED DISTINCT ROWS BY [TO_BIGINT((A.INT_COL1 + 
B.INT_COL2))]\nCLIENT MERGE SORT";
++ "\nSERVER FILTER BY FIRST KEY ONLY\nSERVER 
AGGREGATE INTO ORDERED DISTINCT ROWS BY [TO_BIGINT(\"(A.INT_COL1 + 
B.INT_COL2)\")]\nCLIENT MERGE SORT";
 assertEquals(expectedPlan, QueryUtil.getExplainPlan(rs));
 rs = conn.createStatement().executeQuery(groupBySql);
 assertTrue(rs.next());
@@ -531,7 +531,7 @@ public class IndexExpressionIT extends 
BaseHBaseManagedTimeIT {
 String expectedPlan = "CLIENT PARALLEL 1-WAY RANGE SCAN OVER "
 + (localIndex ? "_LOCAL_IDX_" + fullDataTableName + " 
[-32768,0] - [-32768,*]"
 : "INDEX_TEST.IDX [0] - [*]")
-+ "\nSERVER FILTER BY FIRST KEY ONLY\nSERVER 
AGGREGATE INTO ORDERED DISTINCT ROWS BY [TO_BIGINT((A.INT_COL1 + 1))]\nCLIENT 
MERGE SORT";
++ "\nSERVER FILTER BY FIRST KEY ONLY\nSERVER 
AGGREGATE INTO ORDERED DISTINCT ROWS BY [TO_BIGINT(\"(A.INT_COL1 + 
1)\")]\nCLIENT MERGE SORT";
 assertEquals(expectedPlan, QueryUtil.getExplainPlan(rs));
 rs = conn.createStatement().executeQuery(sql);
 assertTrue(rs.next());



phoenix git commit: Replace public constructors with create() method and set proper collation trait

2015-04-17 Thread maryannxue
Repository: phoenix
Updated Branches:
  refs/heads/calcite 9309fff7e -> c967b7962


Replace public constructors with create() method and set proper collation trait


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

Branch: refs/heads/calcite
Commit: c967b796257a82f2a813bb326c974d6444c35247
Parents: 9309fff
Author: maryannxue 
Authored: Fri Apr 17 00:42:13 2015 -0400
Committer: maryannxue 
Committed: Fri Apr 17 00:42:13 2015 -0400

--
 .../apache/phoenix/calcite/PhoenixTable.java|  4 +-
 .../calcite/rel/PhoenixAbstractJoin.java|  3 +-
 .../calcite/rel/PhoenixAbstractProject.java |  2 +-
 .../calcite/rel/PhoenixAbstractSort.java|  2 +-
 .../calcite/rel/PhoenixClientAggregate.java | 11 ++-
 .../phoenix/calcite/rel/PhoenixClientJoin.java  |  9 ++-
 .../calcite/rel/PhoenixClientProject.java   | 21 -
 .../phoenix/calcite/rel/PhoenixClientSort.java  | 12 ++-
 .../calcite/rel/PhoenixCompactClientSort.java   | 12 ++-
 .../phoenix/calcite/rel/PhoenixFilter.java  |  9 ++-
 .../apache/phoenix/calcite/rel/PhoenixJoin.java |  9 ++-
 .../phoenix/calcite/rel/PhoenixLimit.java   | 44 ---
 .../calcite/rel/PhoenixServerAggregate.java | 11 ++-
 .../phoenix/calcite/rel/PhoenixServerJoin.java  |  9 ++-
 .../calcite/rel/PhoenixServerProject.java   | 21 -
 .../phoenix/calcite/rel/PhoenixServerSort.java  | 12 ++-
 .../phoenix/calcite/rel/PhoenixTableScan.java   | 22 +-
 .../rel/PhoenixToEnumerableConverter.java   | 10 ++-
 .../phoenix/calcite/rel/PhoenixUnion.java   |  9 ++-
 .../phoenix/calcite/rel/PhoenixValues.java  |  8 +-
 .../calcite/rules/PhoenixAddScanLimitRule.java  |  5 +-
 .../calcite/rules/PhoenixClientJoinRule.java| 18 ++---
 .../rules/PhoenixCompactClientSortRule.java |  4 +-
 .../calcite/rules/PhoenixConverterRules.java| 80 ++--
 .../rules/PhoenixFilterScanMergeRule.java   |  5 +-
 .../rules/PhoenixServerAggregateRule.java   |  6 +-
 .../calcite/rules/PhoenixServerJoinRule.java|  4 +-
 .../calcite/rules/PhoenixServerProjectRule.java |  4 +-
 .../calcite/rules/PhoenixServerSortRule.java|  4 +-
 29 files changed, 272 insertions(+), 98 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/c967b796/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixTable.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixTable.java 
b/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixTable.java
index e47521b..a70602e 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixTable.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixTable.java
@@ -72,7 +72,9 @@ public class PhoenixTable extends AbstractTable implements 
TranslatableTable {
 @Override
 public RelNode toRel(RelOptTable.ToRelContext context, RelOptTable 
relOptTable) {
 final RelOptCluster cluster = context.getCluster();
-return new PhoenixTableScan(cluster, 
cluster.traitSetOf(PhoenixRel.CONVENTION), relOptTable, null, null);
+// TODO Is there a better place to do this?
+cluster.setMetadataProvider(PhoenixRel.METADATA_PROVIDER);
+return PhoenixTableScan.create(cluster, relOptTable, null, null);
 }
 
 @Override

http://git-wip-us.apache.org/repos/asf/phoenix/blob/c967b796/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixAbstractJoin.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixAbstractJoin.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixAbstractJoin.java
index 86ad41f..de5f464 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixAbstractJoin.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixAbstractJoin.java
@@ -15,7 +15,8 @@ import org.apache.phoenix.parse.JoinTableNode.JoinType;
  * relational expression in Phoenix.
  */
 abstract public class PhoenixAbstractJoin extends Join implements PhoenixRel {
-public PhoenixAbstractJoin(RelOptCluster cluster, RelTraitSet traits, 
RelNode left, RelNode right, RexNode condition, JoinRelType joinType, 
Set variablesStopped) {
+
+protected PhoenixAbstractJoin(RelOptCluster cluster, RelTraitSet traits, 
RelNode left, RelNode right, RexNode condition, JoinRelType joinType, 
Set variablesStopped) {
 super( cluster, traits, left, right, condition, joinType, 
variablesStopped);
 assert getConvent

phoenix git commit: PHOENIX-1843 Implement getCollations() in PhoenixTable.getStatistics() and all other PhoenixRel nodes

2015-04-21 Thread maryannxue
Repository: phoenix
Updated Branches:
  refs/heads/calcite c967b7962 -> 4c65ef2b5


PHOENIX-1843 Implement getCollations() in PhoenixTable.getStatistics() and all 
other PhoenixRel nodes


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

Branch: refs/heads/calcite
Commit: 4c65ef2b51ae7ac49010ba89b393fb3c5e2bdcca
Parents: c967b79
Author: maryannxue 
Authored: Tue Apr 21 17:14:54 2015 -0400
Committer: maryannxue 
Committed: Tue Apr 21 17:14:54 2015 -0400

--
 .../org/apache/phoenix/calcite/CalciteTest.java | 64 +++---
 .../apache/phoenix/calcite/PhoenixTable.java| 23 +++--
 .../calcite/metadata/PhoenixRelMdCollation.java | 93 
 .../metadata/PhoenixRelMetadataProvider.java|  1 +
 .../calcite/rel/PhoenixAbstractJoin.java|  3 +
 .../calcite/rel/PhoenixAbstractSort.java| 42 +
 .../calcite/rel/PhoenixClientAggregate.java |  2 +-
 .../phoenix/calcite/rel/PhoenixClientJoin.java  | 47 +-
 .../calcite/rel/PhoenixClientProject.java   |  2 +-
 .../phoenix/calcite/rel/PhoenixClientSort.java  | 14 ++-
 .../calcite/rel/PhoenixCompactClientSort.java   | 14 ++-
 .../phoenix/calcite/rel/PhoenixFilter.java  | 20 -
 .../apache/phoenix/calcite/rel/PhoenixJoin.java |  2 +-
 .../phoenix/calcite/rel/PhoenixLimit.java   | 20 +++--
 .../calcite/rel/PhoenixServerAggregate.java |  2 +-
 .../phoenix/calcite/rel/PhoenixServerJoin.java  | 22 +++--
 .../calcite/rel/PhoenixServerProject.java   |  2 +-
 .../phoenix/calcite/rel/PhoenixServerSort.java  | 14 ++-
 .../rel/PhoenixToEnumerableConverter.java   |  2 +-
 .../phoenix/calcite/rel/PhoenixUnion.java   |  2 +-
 .../phoenix/calcite/rel/PhoenixValues.java  |  4 +-
 .../calcite/rules/PhoenixClientJoinRule.java| 32 +--
 .../rules/PhoenixCompactClientSortRule.java |  2 +-
 .../calcite/rules/PhoenixConverterRules.java| 29 +++---
 .../rules/PhoenixInnerSortRemoveRule.java   | 29 ++
 .../calcite/rules/PhoenixServerSortRule.java|  2 +-
 .../apache/phoenix/execute/AggregatePlan.java   |  4 +-
 .../org/apache/phoenix/execute/ScanPlan.java|  4 +-
 28 files changed, 320 insertions(+), 177 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/4c65ef2b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java 
b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
index 05dcc9e..acd230b 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
@@ -261,12 +261,11 @@ public class CalciteTest extends BaseClientManagedTimeIT {
 .explainIs("PhoenixToEnumerableConverter\n" +
"  PhoenixClientProject(item_id=[$0], NAME=[$1], 
supplier_id=[$3], NAME0=[$4])\n" +
"PhoenixClientJoin(condition=[=($2, $3)], 
joinType=[full])\n" +
-   "  PhoenixServerSort(sort0=[$2], 
dir0=[ASC-nulls-first])\n" +
+   "  PhoenixServerSort(sort0=[$2], dir0=[ASC])\n" 
+
"PhoenixServerProject(item_id=[$0], 
NAME=[$1], supplier_id=[$5])\n" +
"  PhoenixTableScan(table=[[phoenix, 
ITEMTABLE]])\n" +
-   "  PhoenixServerSort(sort0=[$0], 
dir0=[ASC-nulls-first])\n" +
-   "PhoenixServerProject(supplier_id=[$0], 
NAME=[$1])\n" +
-   "  PhoenixTableScan(table=[[phoenix, 
SUPPLIERTABLE]])\n")
+   "  PhoenixServerProject(supplier_id=[$0], 
NAME=[$1])\n" +
+   "PhoenixTableScan(table=[[phoenix, 
SUPPLIERTABLE]])\n")
 .close();
 }
 
@@ -382,9 +381,8 @@ public class CalciteTest extends BaseClientManagedTimeIT {
 
 start().sql("select organization_id, entity_id, a_string from aTable 
order by organization_id, entity_id")
 .explainIs("PhoenixToEnumerableConverter\n" +
-   "  PhoenixServerSort(sort0=[$0], sort1=[$1], 
dir0=[ASC], dir1=[ASC])\n" +
-   "PhoenixServerProject(ORGANIZATION_ID=[$0], 
ENTITY_ID=[$1], A_STRING=[$2])\n" +
-   

phoenix git commit: PHOENIX-1773 Backward compatibility for joins fail after PHOENIX-1489

2015-04-23 Thread maryannxue
Repository: phoenix
Updated Branches:
  refs/heads/master 80898c06b -> 124ab6db0


PHOENIX-1773 Backward compatibility for joins fail after PHOENIX-1489


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

Branch: refs/heads/master
Commit: 124ab6db0b95fb30b287e1dfb2a626bd95546219
Parents: 80898c0
Author: maryannxue 
Authored: Thu Apr 23 22:23:05 2015 -0400
Committer: maryannxue 
Committed: Thu Apr 23 22:23:05 2015 -0400

--
 .../java/org/apache/phoenix/join/HashJoinInfo.java | 17 ++---
 1 file changed, 10 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/124ab6db/phoenix-core/src/main/java/org/apache/phoenix/join/HashJoinInfo.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/join/HashJoinInfo.java 
b/phoenix-core/src/main/java/org/apache/phoenix/join/HashJoinInfo.java
index ea78671..31718e5 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/join/HashJoinInfo.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/join/HashJoinInfo.java
@@ -50,9 +50,10 @@ public class HashJoinInfo {
 private int[] fieldPositions;
 private Expression postJoinFilterExpression;
 private Integer limit;
-
+private boolean forceProjection; // always true now, but for backward 
compatibility.
+
 public HashJoinInfo(PTable joinedTable, ImmutableBytesPtr[] joinIds, 
List[] joinExpressions, JoinType[] joinTypes, boolean[] 
earlyEvaluation, PTable[] tables, int[] fieldPositions, Expression 
postJoinFilterExpression, Integer limit) {
-   this(buildSchema(joinedTable), joinIds, joinExpressions, joinTypes, 
earlyEvaluation, buildSchemas(tables), fieldPositions, 
postJoinFilterExpression, limit);
+   this(buildSchema(joinedTable), joinIds, joinExpressions, joinTypes, 
earlyEvaluation, buildSchemas(tables), fieldPositions, 
postJoinFilterExpression, limit, true);
 }
 
 private static KeyValueSchema[] buildSchemas(PTable[] tables) {
@@ -75,7 +76,7 @@ public class HashJoinInfo {
 return builder.build();
 }
 
-private HashJoinInfo(KeyValueSchema joinedSchema, ImmutableBytesPtr[] 
joinIds, List[] joinExpressions, JoinType[] joinTypes, boolean[] 
earlyEvaluation, KeyValueSchema[] schemas, int[] fieldPositions, Expression 
postJoinFilterExpression, Integer limit) {
+private HashJoinInfo(KeyValueSchema joinedSchema, ImmutableBytesPtr[] 
joinIds, List[] joinExpressions, JoinType[] joinTypes, boolean[] 
earlyEvaluation, KeyValueSchema[] schemas, int[] fieldPositions, Expression 
postJoinFilterExpression, Integer limit, boolean forceProjection) {
this.joinedSchema = joinedSchema;
this.joinIds = joinIds;
 this.joinExpressions = joinExpressions;
@@ -85,6 +86,7 @@ public class HashJoinInfo {
 this.fieldPositions = fieldPositions;
 this.postJoinFilterExpression = postJoinFilterExpression;
 this.limit = limit;
+this.forceProjection = forceProjection;
 }
 
 public KeyValueSchema getJoinedSchema() {
@@ -124,7 +126,7 @@ public class HashJoinInfo {
 }
 
 public boolean forceProjection() {
-return true;
+return forceProjection;
 }
  
 public static void serializeHashJoinIntoScan(Scan scan, HashJoinInfo 
joinInfo) {
@@ -153,7 +155,7 @@ public class HashJoinInfo {
 WritableUtils.writeVInt(output, -1);
 }
 WritableUtils.writeVInt(output, joinInfo.limit == null ? -1 : 
joinInfo.limit);
-output.writeBoolean(true);
+output.writeBoolean(joinInfo.forceProjection);
 scan.setAttribute(HASH_JOIN, stream.toByteArray());
 } catch (IOException e) {
 throw new RuntimeException(e);
@@ -210,16 +212,17 @@ public class HashJoinInfo {
 postJoinFilterExpression.readFields(input);
 }
 int limit = -1;
+boolean forceProjection = false;
 // Read these and ignore if we don't find them as they were not
 // present in Apache Phoenix 3.0.0 release. This allows a newer
 // 3.1 server to work with an older 3.0 client without force
 // both to be upgraded in lock step.
 try {
 limit = WritableUtils.readVInt(input);
-input.readBoolean(); // discarded info in new versions
+forceProjection = input.readBoolean();
 } catch (EOFException ignore) {
 }
-return new HashJoinInfo(joinedSchema, joinIds, joinExpressions, 
joinTypes, earlyEvaluation, schemas, fieldP

phoenix git commit: PHOENIX-1773 Backward compatibility for joins fail after PHOENIX-1489

2015-04-23 Thread maryannxue
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-0.98 030204b32 -> 015029b30


PHOENIX-1773 Backward compatibility for joins fail after PHOENIX-1489


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

Branch: refs/heads/4.x-HBase-0.98
Commit: 015029b301b355a501280ba11d31bf72b551224a
Parents: 030204b
Author: maryannxue 
Authored: Thu Apr 23 22:27:21 2015 -0400
Committer: maryannxue 
Committed: Thu Apr 23 22:27:21 2015 -0400

--
 .../java/org/apache/phoenix/join/HashJoinInfo.java | 17 ++---
 1 file changed, 10 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/015029b3/phoenix-core/src/main/java/org/apache/phoenix/join/HashJoinInfo.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/join/HashJoinInfo.java 
b/phoenix-core/src/main/java/org/apache/phoenix/join/HashJoinInfo.java
index ea78671..31718e5 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/join/HashJoinInfo.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/join/HashJoinInfo.java
@@ -50,9 +50,10 @@ public class HashJoinInfo {
 private int[] fieldPositions;
 private Expression postJoinFilterExpression;
 private Integer limit;
-
+private boolean forceProjection; // always true now, but for backward 
compatibility.
+
 public HashJoinInfo(PTable joinedTable, ImmutableBytesPtr[] joinIds, 
List[] joinExpressions, JoinType[] joinTypes, boolean[] 
earlyEvaluation, PTable[] tables, int[] fieldPositions, Expression 
postJoinFilterExpression, Integer limit) {
-   this(buildSchema(joinedTable), joinIds, joinExpressions, joinTypes, 
earlyEvaluation, buildSchemas(tables), fieldPositions, 
postJoinFilterExpression, limit);
+   this(buildSchema(joinedTable), joinIds, joinExpressions, joinTypes, 
earlyEvaluation, buildSchemas(tables), fieldPositions, 
postJoinFilterExpression, limit, true);
 }
 
 private static KeyValueSchema[] buildSchemas(PTable[] tables) {
@@ -75,7 +76,7 @@ public class HashJoinInfo {
 return builder.build();
 }
 
-private HashJoinInfo(KeyValueSchema joinedSchema, ImmutableBytesPtr[] 
joinIds, List[] joinExpressions, JoinType[] joinTypes, boolean[] 
earlyEvaluation, KeyValueSchema[] schemas, int[] fieldPositions, Expression 
postJoinFilterExpression, Integer limit) {
+private HashJoinInfo(KeyValueSchema joinedSchema, ImmutableBytesPtr[] 
joinIds, List[] joinExpressions, JoinType[] joinTypes, boolean[] 
earlyEvaluation, KeyValueSchema[] schemas, int[] fieldPositions, Expression 
postJoinFilterExpression, Integer limit, boolean forceProjection) {
this.joinedSchema = joinedSchema;
this.joinIds = joinIds;
 this.joinExpressions = joinExpressions;
@@ -85,6 +86,7 @@ public class HashJoinInfo {
 this.fieldPositions = fieldPositions;
 this.postJoinFilterExpression = postJoinFilterExpression;
 this.limit = limit;
+this.forceProjection = forceProjection;
 }
 
 public KeyValueSchema getJoinedSchema() {
@@ -124,7 +126,7 @@ public class HashJoinInfo {
 }
 
 public boolean forceProjection() {
-return true;
+return forceProjection;
 }
  
 public static void serializeHashJoinIntoScan(Scan scan, HashJoinInfo 
joinInfo) {
@@ -153,7 +155,7 @@ public class HashJoinInfo {
 WritableUtils.writeVInt(output, -1);
 }
 WritableUtils.writeVInt(output, joinInfo.limit == null ? -1 : 
joinInfo.limit);
-output.writeBoolean(true);
+output.writeBoolean(joinInfo.forceProjection);
 scan.setAttribute(HASH_JOIN, stream.toByteArray());
 } catch (IOException e) {
 throw new RuntimeException(e);
@@ -210,16 +212,17 @@ public class HashJoinInfo {
 postJoinFilterExpression.readFields(input);
 }
 int limit = -1;
+boolean forceProjection = false;
 // Read these and ignore if we don't find them as they were not
 // present in Apache Phoenix 3.0.0 release. This allows a newer
 // 3.1 server to work with an older 3.0 client without force
 // both to be upgraded in lock step.
 try {
 limit = WritableUtils.readVInt(input);
-input.readBoolean(); // discarded info in new versions
+forceProjection = input.readBoolean();
 } catch (EOFException ignore) {
 }
-return new HashJoinInfo(joinedSchema, joinIds, joinExpressions, 
joinTypes, earlyEvaluation,

phoenix git commit: Implemented PhoenixCalciteDriver and moved some init logic to PhoenixPrepareImpl

2015-04-24 Thread maryannxue
Repository: phoenix
Updated Branches:
  refs/heads/calcite 4c65ef2b5 -> 086462884


Implemented PhoenixCalciteDriver and moved some init logic to PhoenixPrepareImpl


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

Branch: refs/heads/calcite
Commit: 086462884ef8824724d2d1503de83aeea4056433
Parents: 4c65ef2
Author: maryannxue 
Authored: Fri Apr 24 12:01:41 2015 -0400
Committer: maryannxue 
Committed: Fri Apr 24 12:01:41 2015 -0400

--
 .../org/apache/phoenix/calcite/CalciteTest.java |  9 +++-
 .../calcite/jdbc/PhoenixCalciteDriver.java  | 30 +++
 .../calcite/jdbc/PhoenixPrepareImpl.java| 52 
 .../phoenix/calcite/rel/PhoenixTableScan.java   | 33 -
 phoenix-core/src/main/resources/java.sql.Driver |  2 +-
 5 files changed, 90 insertions(+), 36 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/08646288/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java 
b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
index acd230b..67c764c 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
@@ -139,10 +139,15 @@ public class CalciteTest extends BaseClientManagedTimeIT {
 
 private static Connection createConnection() throws SQLException {
 final Connection connection = DriverManager.getConnection(
-"jdbc:calcite:");
+"jdbc:phoenixcalcite:");
 final CalciteConnection calciteConnection =
 connection.unwrap(CalciteConnection.class);
 final String url = getUrl();
+try {
+Class.forName("org.apache.phoenix.jdbc.PhoenixDriver");
+} catch (ClassNotFoundException e) {
+throw new RuntimeException(e);
+}
 final PhoenixConnection phoenixConnection =
 DriverManager.getConnection(url).unwrap(PhoenixConnection.class);
 calciteConnection.getRootSchema().add("phoenix",
@@ -174,7 +179,7 @@ public class CalciteTest extends BaseClientManagedTimeIT {
 + "}\n");
 pw.close();
 final Connection connection =
-DriverManager.getConnection("jdbc:calcite:model=" + 
file.getAbsolutePath());
+DriverManager.getConnection("jdbc:phoenixcalcite:model=" + 
file.getAbsolutePath());
 return connection;
 }
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/08646288/phoenix-core/src/main/java/org/apache/phoenix/calcite/jdbc/PhoenixCalciteDriver.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/calcite/jdbc/PhoenixCalciteDriver.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/calcite/jdbc/PhoenixCalciteDriver.java
new file mode 100644
index 000..37452df
--- /dev/null
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/calcite/jdbc/PhoenixCalciteDriver.java
@@ -0,0 +1,30 @@
+package org.apache.phoenix.calcite.jdbc;
+
+import org.apache.calcite.jdbc.CalcitePrepare;
+import org.apache.calcite.jdbc.Driver;
+import org.apache.calcite.linq4j.function.Function0;
+
+public class PhoenixCalciteDriver extends Driver {
+public static final String CONNECT_STRING_PREFIX = "jdbc:phoenixcalcite:";
+
+static {
+new PhoenixCalciteDriver().register();
+}
+
+public PhoenixCalciteDriver() {
+super();
+}
+
+@Override protected Function0 createPrepareFactory() {
+return new Function0() {
+@Override
+public CalcitePrepare apply() {
+return new PhoenixPrepareImpl();
+}  
+};
+}
+
+@Override protected String getConnectStringPrefix() {
+return CONNECT_STRING_PREFIX;
+}
+}

http://git-wip-us.apache.org/repos/asf/phoenix/blob/08646288/phoenix-core/src/main/java/org/apache/phoenix/calcite/jdbc/PhoenixPrepareImpl.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/calcite/jdbc/PhoenixPrepareImpl.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/calcite/jdbc/PhoenixPrepareImpl.java
new file mode 100644
index 000..aa628e7
--- /dev/null
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/calcite/jdbc/PhoenixPrepareImpl.java
@@ -0,0 +1,52 @@
+package org.apa

phoenix git commit: PHOENIX-1917 Correlated subquery fails if the inner query contains JOIN

2015-04-24 Thread maryannxue
Repository: phoenix
Updated Branches:
  refs/heads/master 96054823b -> 20e772caf


PHOENIX-1917 Correlated subquery fails if the inner query contains JOIN


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

Branch: refs/heads/master
Commit: 20e772caf23eb853a458a80a0c5b70affaa44944
Parents: 9605482
Author: maryannxue 
Authored: Fri Apr 24 15:59:39 2015 -0400
Committer: maryannxue 
Committed: Fri Apr 24 15:59:39 2015 -0400

--
 .../org/apache/phoenix/end2end/SubqueryIT.java| 18 ++
 .../apache/phoenix/compile/SubqueryRewriter.java  |  2 ++
 2 files changed, 20 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/20e772ca/phoenix-core/src/it/java/org/apache/phoenix/end2end/SubqueryIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SubqueryIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SubqueryIT.java
index 13354da..794c4f5 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SubqueryIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SubqueryIT.java
@@ -648,6 +648,24 @@ public class SubqueryIT extends BaseHBaseManagedTimeIT {
 
 assertFalse(rs.next());
 
+query = "SELECT \"order_id\", name FROM " + 
JOIN_ORDER_TABLE_FULL_NAME + " o JOIN " + JOIN_ITEM_TABLE_FULL_NAME + " i ON 
o.\"item_id\" = i.\"item_id\" WHERE quantity = (SELECT max(quantity) FROM " + 
JOIN_ITEM_TABLE_FULL_NAME + " i2 JOIN " + JOIN_ORDER_TABLE_FULL_NAME + " q ON 
i2.\"item_id\" = q.\"item_id\" WHERE o.\"item_id\" = i2.\"item_id\")";
+statement = conn.prepareStatement(query);
+rs = statement.executeQuery();
+assertTrue (rs.next());
+assertEquals(rs.getString(1), "001");
+assertEquals(rs.getString(2), "T1");
+assertTrue (rs.next());
+assertEquals(rs.getString(1), "003");
+assertEquals(rs.getString(2), "T2");
+assertTrue (rs.next());
+assertEquals(rs.getString(1), "004");
+assertEquals(rs.getString(2), "T6");
+assertTrue (rs.next());
+assertEquals(rs.getString(1), "005");
+assertEquals(rs.getString(2), "T3");
+
+assertFalse(rs.next());
+
 query = "SELECT name from " + JOIN_CUSTOMER_TABLE_FULL_NAME + " 
WHERE \"customer_id\" IN (SELECT \"customer_id\" FROM " + 
JOIN_ITEM_TABLE_FULL_NAME + " i JOIN " + JOIN_ORDER_TABLE_FULL_NAME + " o ON 
o.\"item_id\" = i.\"item_id\" WHERE i.name = 'T2' OR quantity > (SELECT 
avg(quantity) FROM " + JOIN_ORDER_TABLE_FULL_NAME + " q WHERE o.\"item_id\" = 
q.\"item_id\"))";
 statement = conn.prepareStatement(query);
 rs = statement.executeQuery();

http://git-wip-us.apache.org/repos/asf/phoenix/blob/20e772ca/phoenix-core/src/main/java/org/apache/phoenix/compile/SubqueryRewriter.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/compile/SubqueryRewriter.java 
b/phoenix-core/src/main/java/org/apache/phoenix/compile/SubqueryRewriter.java
index 8e887a8..1746d8a 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/compile/SubqueryRewriter.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/compile/SubqueryRewriter.java
@@ -52,6 +52,7 @@ import org.apache.phoenix.parse.TableName;
 import org.apache.phoenix.parse.TableNode;
 import org.apache.phoenix.schema.ColumnFamilyNotFoundException;
 import org.apache.phoenix.schema.ColumnNotFoundException;
+import org.apache.phoenix.schema.TableNotFoundException;
 
 import com.google.common.collect.Lists;
 
@@ -557,6 +558,7 @@ public class SubqueryRewriter extends ParseNodeRewriter {
 localResolver.resolveColumn(node.getSchemaName(), 
node.getTableName(), node.getName());
 addType(true);
 return null;
+} catch (TableNotFoundException e) {
 } catch (ColumnNotFoundException e) { 
 } catch (ColumnFamilyNotFoundException e) {
 }



phoenix git commit: PHOENIX-1917 Correlated subquery fails if the inner query contains JOIN

2015-04-24 Thread maryannxue
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-0.98 269e86ab6 -> 43a7aba9b


PHOENIX-1917 Correlated subquery fails if the inner query contains JOIN


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

Branch: refs/heads/4.x-HBase-0.98
Commit: 43a7aba9b5ddd6cc3fc285a7a4a35554740b6a96
Parents: 269e86a
Author: maryannxue 
Authored: Fri Apr 24 16:04:38 2015 -0400
Committer: maryannxue 
Committed: Fri Apr 24 16:04:38 2015 -0400

--
 .../org/apache/phoenix/end2end/SubqueryIT.java| 18 ++
 .../apache/phoenix/compile/SubqueryRewriter.java  |  2 ++
 2 files changed, 20 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/43a7aba9/phoenix-core/src/it/java/org/apache/phoenix/end2end/SubqueryIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SubqueryIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SubqueryIT.java
index 13354da..794c4f5 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SubqueryIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SubqueryIT.java
@@ -648,6 +648,24 @@ public class SubqueryIT extends BaseHBaseManagedTimeIT {
 
 assertFalse(rs.next());
 
+query = "SELECT \"order_id\", name FROM " + 
JOIN_ORDER_TABLE_FULL_NAME + " o JOIN " + JOIN_ITEM_TABLE_FULL_NAME + " i ON 
o.\"item_id\" = i.\"item_id\" WHERE quantity = (SELECT max(quantity) FROM " + 
JOIN_ITEM_TABLE_FULL_NAME + " i2 JOIN " + JOIN_ORDER_TABLE_FULL_NAME + " q ON 
i2.\"item_id\" = q.\"item_id\" WHERE o.\"item_id\" = i2.\"item_id\")";
+statement = conn.prepareStatement(query);
+rs = statement.executeQuery();
+assertTrue (rs.next());
+assertEquals(rs.getString(1), "001");
+assertEquals(rs.getString(2), "T1");
+assertTrue (rs.next());
+assertEquals(rs.getString(1), "003");
+assertEquals(rs.getString(2), "T2");
+assertTrue (rs.next());
+assertEquals(rs.getString(1), "004");
+assertEquals(rs.getString(2), "T6");
+assertTrue (rs.next());
+assertEquals(rs.getString(1), "005");
+assertEquals(rs.getString(2), "T3");
+
+assertFalse(rs.next());
+
 query = "SELECT name from " + JOIN_CUSTOMER_TABLE_FULL_NAME + " 
WHERE \"customer_id\" IN (SELECT \"customer_id\" FROM " + 
JOIN_ITEM_TABLE_FULL_NAME + " i JOIN " + JOIN_ORDER_TABLE_FULL_NAME + " o ON 
o.\"item_id\" = i.\"item_id\" WHERE i.name = 'T2' OR quantity > (SELECT 
avg(quantity) FROM " + JOIN_ORDER_TABLE_FULL_NAME + " q WHERE o.\"item_id\" = 
q.\"item_id\"))";
 statement = conn.prepareStatement(query);
 rs = statement.executeQuery();

http://git-wip-us.apache.org/repos/asf/phoenix/blob/43a7aba9/phoenix-core/src/main/java/org/apache/phoenix/compile/SubqueryRewriter.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/compile/SubqueryRewriter.java 
b/phoenix-core/src/main/java/org/apache/phoenix/compile/SubqueryRewriter.java
index 8e887a8..1746d8a 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/compile/SubqueryRewriter.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/compile/SubqueryRewriter.java
@@ -52,6 +52,7 @@ import org.apache.phoenix.parse.TableName;
 import org.apache.phoenix.parse.TableNode;
 import org.apache.phoenix.schema.ColumnFamilyNotFoundException;
 import org.apache.phoenix.schema.ColumnNotFoundException;
+import org.apache.phoenix.schema.TableNotFoundException;
 
 import com.google.common.collect.Lists;
 
@@ -557,6 +558,7 @@ public class SubqueryRewriter extends ParseNodeRewriter {
 localResolver.resolveColumn(node.getSchemaName(), 
node.getTableName(), node.getName());
 addType(true);
 return null;
+} catch (TableNotFoundException e) {
 } catch (ColumnNotFoundException e) { 
 } catch (ColumnFamilyNotFoundException e) {
 }



phoenix git commit: Implement PhoenixSchema; Add testJoinHsqldb

2015-04-27 Thread maryannxue
Repository: phoenix
Updated Branches:
  refs/heads/calcite 086462884 -> d555ee62f


Implement PhoenixSchema; Add testJoinHsqldb


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

Branch: refs/heads/calcite
Commit: d555ee62f6c4b308acf4c8bc86bb6a5b3542dd14
Parents: 0864628
Author: maryannxue 
Authored: Mon Apr 27 13:14:34 2015 -0400
Committer: maryannxue 
Committed: Mon Apr 27 13:14:34 2015 -0400

--
 phoenix-core/pom.xml|  8 ++
 .../org/apache/phoenix/calcite/CalciteTest.java | 92 +++-
 .../apache/phoenix/calcite/PhoenixSchema.java   | 33 +--
 .../apache/phoenix/calcite/PhoenixTable.java|  2 +-
 .../java/org/apache/phoenix/util/TestUtil.java  | 16 ++--
 pom.xml | 12 +++
 6 files changed, 124 insertions(+), 39 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/d555ee62/phoenix-core/pom.xml
--
diff --git a/phoenix-core/pom.xml b/phoenix-core/pom.xml
index 89adf1f..3fe2c7a 100644
--- a/phoenix-core/pom.xml
+++ b/phoenix-core/pom.xml
@@ -430,5 +430,13 @@
 joni
 ${joni.version}
 
+
+  net.hydromatic
+  foodmart-data-hsqldb
+
+
+  org.hsqldb
+  hsqldb
+
   
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d555ee62/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java 
b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
index 67c764c..f7c8b21 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
@@ -2,7 +2,9 @@ package org.apache.phoenix.calcite;
 
 import com.google.common.collect.Lists;
 
+import org.apache.calcite.adapter.jdbc.JdbcSchema;
 import org.apache.calcite.jdbc.CalciteConnection;
+import org.apache.calcite.schema.SchemaPlus;
 import org.apache.phoenix.end2end.BaseClientManagedTimeIT;
 import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.junit.Before;
@@ -14,6 +16,8 @@ import java.io.PrintWriter;
 import java.sql.*;
 import java.util.List;
 
+import javax.sql.DataSource;
+
 import static org.apache.phoenix.util.TestUtil.JOIN_ITEM_TABLE_FULL_NAME;
 import static org.apache.phoenix.util.TestUtil.JOIN_ORDER_TABLE_FULL_NAME;
 import static org.apache.phoenix.util.TestUtil.JOIN_SUPPLIER_TABLE_FULL_NAME;
@@ -151,10 +155,23 @@ public class CalciteTest extends BaseClientManagedTimeIT {
 final PhoenixConnection phoenixConnection =
 DriverManager.getConnection(url).unwrap(PhoenixConnection.class);
 calciteConnection.getRootSchema().add("phoenix",
-new PhoenixSchema(phoenixConnection));
+new PhoenixSchema(null, phoenixConnection));
 calciteConnection.setSchema("phoenix");
 return connection;
 }
+
+private static Connection createConnectionWithHsqldb() throws SQLException 
{
+final Connection connection = createConnection();
+final CalciteConnection calciteConnection =
+connection.unwrap(CalciteConnection.class);
+DataSource dataSource =
+JdbcSchema.dataSource("jdbc:hsqldb:res:foodmart", 
"org.hsqldb.jdbcDriver", "FOODMART", "FOODMART");
+SchemaPlus rootSchema = calciteConnection.getRootSchema();
+rootSchema.add("foodmart",
+JdbcSchema.create(rootSchema, "foodmart", dataSource, null,
+"foodmart"));
+return connection;
+}
 
 private static Connection connectUsingModel() throws Exception {
 final File file = File.createTempFile("model", ".json");
@@ -237,9 +254,9 @@ public class CalciteTest extends BaseClientManagedTimeIT {
"  PhoenixServerProject(item_id=[$0], NAME=[$1], 
supplier_id=[$3], NAME0=[$4])\n" +
"PhoenixServerJoin(condition=[=($2, $3)], 
joinType=[inner])\n" +
"  PhoenixServerProject(item_id=[$0], 
NAME=[$1], supplier_id=[$5])\n" +
-   "PhoenixTableScan(table=[[phoenix, 
ITEMTABLE]])\n" +
+   "PhoenixTableScan(table=[[phoenix, Join, 
ItemTable]])\n" +
  

phoenix git commit: TetestConnectJoinHsqldb ran with results

2015-04-27 Thread maryannxue
Repository: phoenix
Updated Branches:
  refs/heads/calcite d555ee62f -> 0b1b7e0f0


TetestConnectJoinHsqldb ran with results


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

Branch: refs/heads/calcite
Commit: 0b1b7e0f0c2e9d5c954e4cec71e9ca3b050fd52b
Parents: d555ee6
Author: maryannxue 
Authored: Mon Apr 27 18:31:29 2015 -0400
Committer: maryannxue 
Committed: Mon Apr 27 18:31:29 2015 -0400

--
 .../org/apache/phoenix/calcite/CalciteTest.java | 63 ++--
 .../apache/phoenix/calcite/PhoenixSchema.java   | 10 ++--
 phoenix-core/src/main/resources/java.sql.Driver |  1 +
 .../java/org/apache/phoenix/query/BaseTest.java | 13 +++-
 4 files changed, 50 insertions(+), 37 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/0b1b7e0f/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java 
b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
index f7c8b21..91eb6b9 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
@@ -1,12 +1,12 @@
 package org.apache.phoenix.calcite;
 
 import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
 
 import org.apache.calcite.adapter.jdbc.JdbcSchema;
 import org.apache.calcite.jdbc.CalciteConnection;
 import org.apache.calcite.schema.SchemaPlus;
 import org.apache.phoenix.end2end.BaseClientManagedTimeIT;
-import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -15,6 +15,7 @@ import java.io.FileWriter;
 import java.io.PrintWriter;
 import java.sql.*;
 import java.util.List;
+import java.util.Map;
 
 import javax.sql.DataSource;
 
@@ -147,15 +148,11 @@ public class CalciteTest extends BaseClientManagedTimeIT {
 final CalciteConnection calciteConnection =
 connection.unwrap(CalciteConnection.class);
 final String url = getUrl();
-try {
-Class.forName("org.apache.phoenix.jdbc.PhoenixDriver");
-} catch (ClassNotFoundException e) {
-throw new RuntimeException(e);
-}
-final PhoenixConnection phoenixConnection =
-DriverManager.getConnection(url).unwrap(PhoenixConnection.class);
-calciteConnection.getRootSchema().add("phoenix",
-new PhoenixSchema(null, phoenixConnection));
+Map operand = Maps.newHashMap();
+operand.put("url", url);
+SchemaPlus rootSchema = calciteConnection.getRootSchema();
+rootSchema.add("phoenix",
+PhoenixSchema.FACTORY.create(rootSchema, null, operand));
 calciteConnection.setSchema("phoenix");
 return connection;
 }
@@ -603,11 +600,11 @@ public class CalciteTest extends BaseClientManagedTimeIT {
 start().sql("SELECT \"order_id\", quantity FROM " + 
JOIN_ORDER_TABLE_FULL_NAME + " o WHERE quantity = (SELECT max(quantity) FROM " 
+ JOIN_ORDER_TABLE_FULL_NAME + " q WHERE o.\"item_id\" = q.\"item_id\")")
.explainIs("PhoenixToEnumerableConverter\n" +
   "  PhoenixServerProject(order_id=[$0], 
QUANTITY=[$4])\n" +
-  "PhoenixServerJoin(condition=[AND(=($2, $6), 
=($4, $7))], joinType=[inner])\n" +
+  "PhoenixServerJoin(condition=[AND(=($2, $7), 
=($4, $8))], joinType=[inner])\n" +
   "  PhoenixTableScan(table=[[phoenix, Join, 
OrderTable]])\n" +
   "  PhoenixServerAggregate(group=[{0}], 
EXPR$0=[MAX($1)])\n" +
-  "PhoenixServerProject(item_id0=[$6], 
QUANTITY=[$4])\n" +
-  "  PhoenixServerJoin(condition=[=($6, $2)], 
joinType=[inner])\n" +
+  "PhoenixServerProject(item_id0=[$7], 
QUANTITY=[$4])\n" +
+  "  PhoenixServerJoin(condition=[=($7, $2)], 
joinType=[inner])\n" +
   "PhoenixTableScan(table=[[phoenix, Join, 
OrderTable]])\n" +
   "PhoenixServerAggregate(group=[{0}])\n" +
   "  PhoenixServerProject(item_id=[$2])\n" 
+
@

phoenix git commit: add testScalarSubquery

2015-04-28 Thread maryannxue
Repository: phoenix
Updated Branches:
  refs/heads/calcite 0b1b7e0f0 -> 2d0834592


add testScalarSubquery


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

Branch: refs/heads/calcite
Commit: 2d083459267f4442cda674c94ea2a376a14f7f7e
Parents: 0b1b7e0
Author: maryannxue 
Authored: Tue Apr 28 19:18:44 2015 -0400
Committer: maryannxue 
Committed: Tue Apr 28 19:18:44 2015 -0400

--
 .../org/apache/phoenix/calcite/CalciteTest.java | 95 +++-
 .../apache/phoenix/calcite/CalciteUtils.java|  2 +-
 .../calcite/jdbc/PhoenixPrepareImpl.java|  2 +
 .../PhoenixSingleValueAggregateRemoveRule.java  | 55 
 4 files changed, 129 insertions(+), 25 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/2d083459/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java 
b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
index 91eb6b9..7b9c30d 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
@@ -3,7 +3,6 @@ package org.apache.phoenix.calcite;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 
-import org.apache.calcite.adapter.jdbc.JdbcSchema;
 import org.apache.calcite.jdbc.CalciteConnection;
 import org.apache.calcite.schema.SchemaPlus;
 import org.apache.phoenix.end2end.BaseClientManagedTimeIT;
@@ -17,8 +16,6 @@ import java.sql.*;
 import java.util.List;
 import java.util.Map;
 
-import javax.sql.DataSource;
-
 import static org.apache.phoenix.util.TestUtil.JOIN_ITEM_TABLE_FULL_NAME;
 import static org.apache.phoenix.util.TestUtil.JOIN_ORDER_TABLE_FULL_NAME;
 import static org.apache.phoenix.util.TestUtil.JOIN_SUPPLIER_TABLE_FULL_NAME;
@@ -156,17 +153,42 @@ public class CalciteTest extends BaseClientManagedTimeIT {
 calciteConnection.setSchema("phoenix");
 return connection;
 }
+
+private static final String FOODMART_SCHEMA = " {\n"
++ "   type: 'jdbc',\n"
++ "   name: 'foodmart',\n"
++ "   jdbcDriver: 'org.hsqldb.jdbcDriver',\n"
++ "   jdbcUser: 'FOODMART',\n"
++ "   jdbcPassword: 'FOODMART',\n"
++ "   jdbcUrl: 'jdbc:hsqldb:res:foodmart',\n"
++ "   jdbcCatalog: null,\n"
++ "   jdbcSchema: 'foodmart'\n"
++ " }";
 
-private static Connection createConnectionWithHsqldb() throws SQLException 
{
-final Connection connection = createConnection();
-final CalciteConnection calciteConnection =
-connection.unwrap(CalciteConnection.class);
-DataSource dataSource =
-JdbcSchema.dataSource("jdbc:hsqldb:res:foodmart", 
"org.hsqldb.jdbcDriver", "FOODMART", "FOODMART");
-SchemaPlus rootSchema = calciteConnection.getRootSchema();
-rootSchema.add("foodmart",
-JdbcSchema.create(rootSchema, "foodmart", dataSource, null,
-"foodmart"));
+private static final String PHOENIX_SCHEMA = "{\n"
++ "  name: 'phoenix',\n"
++ "  type: 'custom',\n"
++ "  factory: 
'org.apache.phoenix.calcite.PhoenixSchema$Factory',\n"
++ "  operand: {\n"
++ "url: \"" + getUrl() + "\"\n"
++ "  }\n"
++ "}";
+
+private static Connection connectWithHsqldbUsingModel() throws Exception {
+final File file = File.createTempFile("model", ".json");
+final PrintWriter pw = new PrintWriter(new FileWriter(file));
+pw.print(
+"{\n"
++ "  version: '1.0',\n"
++ "  defaultSchema: 'phoenix',\n"
++ "  schemas: [\n"
++ PHOENIX_SCHEMA + ",\n"
++ FOODMART_SCHEMA + "\n"
++ "  ]\n"
++ "}\n");
+   

phoenix git commit: Replace dummy implementation with PTable.getStatistics()

2015-04-28 Thread maryannxue
Repository: phoenix
Updated Branches:
  refs/heads/calcite 2d0834592 -> 977d78c16


Replace dummy implementation with PTable.getStatistics()


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

Branch: refs/heads/calcite
Commit: 977d78c16fa937cc64382c93216714e2959933e8
Parents: 2d08345
Author: maryannxue 
Authored: Tue Apr 28 23:25:09 2015 -0400
Committer: maryannxue 
Committed: Tue Apr 28 23:25:09 2015 -0400

--
 .../java/org/apache/phoenix/calcite/CalciteTest.java   |  8 
 .../java/org/apache/phoenix/calcite/PhoenixTable.java  | 13 ++---
 2 files changed, 18 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/977d78c1/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java 
b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
index 7b9c30d..620a375 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
@@ -16,6 +16,7 @@ import java.sql.*;
 import java.util.List;
 import java.util.Map;
 
+import static org.apache.phoenix.util.TestUtil.JOIN_CUSTOMER_TABLE_FULL_NAME;
 import static org.apache.phoenix.util.TestUtil.JOIN_ITEM_TABLE_FULL_NAME;
 import static org.apache.phoenix.util.TestUtil.JOIN_ORDER_TABLE_FULL_NAME;
 import static org.apache.phoenix.util.TestUtil.JOIN_SUPPLIER_TABLE_FULL_NAME;
@@ -225,6 +226,13 @@ public class CalciteTest extends BaseClientManagedTimeIT {
 ensureTableCreated(url, ATABLE_NAME);
 initATableValues(getOrganizationId(), null, url);
 initJoinTableValues(url, null, null);
+final Connection connection = DriverManager.getConnection(url);
+connection.createStatement().execute("UPDATE STATISTICS ATABLE");
+connection.createStatement().execute("UPDATE STATISTICS " + 
JOIN_CUSTOMER_TABLE_FULL_NAME);
+connection.createStatement().execute("UPDATE STATISTICS " + 
JOIN_ITEM_TABLE_FULL_NAME);
+connection.createStatement().execute("UPDATE STATISTICS " + 
JOIN_SUPPLIER_TABLE_FULL_NAME);
+connection.createStatement().execute("UPDATE STATISTICS " + 
JOIN_ORDER_TABLE_FULL_NAME);
+connection.close();
 }
 
 @Test public void testTableScan() throws Exception {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/977d78c1/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixTable.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixTable.java 
b/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixTable.java
index e9378af..ea52edf 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixTable.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixTable.java
@@ -1,6 +1,7 @@
 package org.apache.phoenix.calcite;
 
 import java.util.List;
+import java.util.Map;
 
 import org.apache.calcite.plan.RelOptCluster;
 import org.apache.calcite.plan.RelOptTable;
@@ -25,6 +26,7 @@ import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.schema.PColumn;
 import org.apache.phoenix.schema.PTable;
 import org.apache.phoenix.schema.SortOrder;
+import org.apache.phoenix.schema.stats.GuidePostsInfo;
 import org.apache.phoenix.schema.types.PDataType;
 
 import com.google.common.base.Preconditions;
@@ -93,9 +95,14 @@ public class PhoenixTable extends AbstractTable implements 
TranslatableTable {
 return new Statistic() {
 @Override
 public Double getRowCount() {
-// TODO
-String tableName = pTable.getTableName().getString();
-return tableName.equals("ItemTable") ? 70d : 
tableName.equals("SupplierTable") ? 60d : 100d;
+int rowCount = 0;
+for (Map.Entry entry : 
pTable.getTableStats().getGuidePosts().entrySet()) {
+rowCount += entry.getValue().getRowCount();
+}
+
+// Return an non-zero value to make the query plans stable.
+// TODO remove "* 10.0" which is for test purpose.
+return rowCount > 0 ? rowCount * 10.0 : 100.0;
 }
 
 @Override



phoenix git commit: Fix getRowCount()

2015-04-29 Thread maryannxue
Repository: phoenix
Updated Branches:
  refs/heads/calcite 977d78c16 -> ff4c733e3


Fix getRowCount()


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

Branch: refs/heads/calcite
Commit: ff4c733e39ee18531adcefc08873d5e63cf8ecc3
Parents: 977d78c
Author: maryannxue 
Authored: Wed Apr 29 12:22:57 2015 -0400
Committer: maryannxue 
Committed: Wed Apr 29 12:22:57 2015 -0400

--
 .../main/java/org/apache/phoenix/calcite/PhoenixTable.java   | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/ff4c733e/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixTable.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixTable.java 
b/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixTable.java
index ea52edf..a8e16d1 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixTable.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixTable.java
@@ -28,6 +28,7 @@ import org.apache.phoenix.schema.PTable;
 import org.apache.phoenix.schema.SortOrder;
 import org.apache.phoenix.schema.stats.GuidePostsInfo;
 import org.apache.phoenix.schema.types.PDataType;
+import org.apache.phoenix.util.SchemaUtil;
 
 import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableList;
@@ -95,10 +96,9 @@ public class PhoenixTable extends AbstractTable implements 
TranslatableTable {
 return new Statistic() {
 @Override
 public Double getRowCount() {
-int rowCount = 0;
-for (Map.Entry entry : 
pTable.getTableStats().getGuidePosts().entrySet()) {
-rowCount += entry.getValue().getRowCount();
-}
+byte[] emptyCf = SchemaUtil.getEmptyColumnFamily(pTable);
+GuidePostsInfo info = 
pTable.getTableStats().getGuidePosts().get(emptyCf);
+long rowCount = info == null ? 0 : info.getRowCount();
 
 // Return an non-zero value to make the query plans stable.
 // TODO remove "* 10.0" which is for test purpose.



phoenix git commit: Add PhoenixJoinSingleValueAggregateMergeRule

2015-04-29 Thread maryannxue
Repository: phoenix
Updated Branches:
  refs/heads/calcite ff4c733e3 -> 5cf992ef6


Add PhoenixJoinSingleValueAggregateMergeRule


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

Branch: refs/heads/calcite
Commit: 5cf992ef6e4c62afff7c700a27d239e07bcae998
Parents: ff4c733
Author: maryannxue 
Authored: Wed Apr 29 18:47:35 2015 -0400
Committer: maryannxue 
Committed: Wed Apr 29 18:47:35 2015 -0400

--
 .../org/apache/phoenix/calcite/CalciteTest.java | 21 
 .../apache/phoenix/calcite/PhoenixTable.java|  1 -
 .../calcite/jdbc/PhoenixPrepareImpl.java|  4 +-
 .../calcite/metadata/PhoenixRelMdCollation.java | 23 +---
 .../calcite/metadata/PhoenixRelMdRowCount.java  | 23 
 .../calcite/rel/PhoenixAbstractAggregate.java   | 20 +++
 .../calcite/rel/PhoenixAbstractJoin.java| 16 +-
 .../phoenix/calcite/rel/PhoenixClientJoin.java  | 20 ---
 .../phoenix/calcite/rel/PhoenixServerJoin.java  | 22 +---
 .../calcite/rules/PhoenixClientJoinRule.java| 16 +-
 ...hoenixJoinSingleValueAggregateMergeRule.java | 51 ++
 .../calcite/rules/PhoenixServerJoinRule.java|  6 +--
 .../PhoenixSingleValueAggregateRemoveRule.java  | 55 
 13 files changed, 169 insertions(+), 109 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/5cf992ef/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java 
b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
index 620a375..6b7065b 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
@@ -661,15 +661,16 @@ public class CalciteTest extends BaseClientManagedTimeIT {
"  EnumerableJoin(condition=[=($6, $7)], 
joinType=[left])\n" +
"PhoenixToEnumerableConverter\n" +
"  PhoenixTableScan(table=[[phoenix, Join, 
OrderTable]])\n" +
-   "EnumerableAggregate(group=[{0}], CNT=[COUNT()])\n" 
+
-   "  EnumerableCalc(expr#0..10=[{inputs}], 
expr#11=[0], expr#12=[CAST($t5):INTEGER], expr#13=[=($t12, $t0)], 
THE_YEAR=[$t0], $f0=[$t11], $condition=[$t13])\n" +
-   "EnumerableJoin(condition=[true], 
joinType=[inner])\n" +
-   "  PhoenixToEnumerableConverter\n" +
-   "PhoenixServerAggregate(group=[{0}])\n" +
-   "  PhoenixServerProject(THE_YEAR=[$6])\n" +
-   "PhoenixTableScan(table=[[phoenix, 
Join, OrderTable]])\n" +
-   "  JdbcToEnumerableConverter\n" +
-   "JdbcTableScan(table=[[foodmart, 
time_by_day]])\n")
+   "EnumerableAggregate(group=[{0}], 
agg#0=[SINGLE_VALUE($1)])\n" +
+   "  EnumerableAggregate(group=[{0}], 
CNT=[COUNT()])\n" +
+   "EnumerableCalc(expr#0..10=[{inputs}], 
expr#11=[0], expr#12=[CAST($t5):INTEGER], expr#13=[=($t12, $t0)], 
THE_YEAR=[$t0], $f0=[$t11], $condition=[$t13])\n" +
+   "  EnumerableJoin(condition=[true], 
joinType=[inner])\n" +
+   "PhoenixToEnumerableConverter\n" +
+   "  PhoenixServerAggregate(group=[{0}])\n" +
+   "PhoenixServerProject(THE_YEAR=[$6])\n" 
+
+   "  PhoenixTableScan(table=[[phoenix, 
Join, OrderTable]])\n" +
+   "JdbcToEnumerableConverter\n" +
+   "  JdbcTableScan(table=[[foodmart, 
time_by_day]])\n")
 .resultIs(new Object[][] {
 new Object[] {1997, 1000, 365L}, 
 new Object[] {1997, 2000, 365L},
@@ -685,7 +686,7 @@ public class CalciteTest extends BaseClientManagedTimeIT {
 + "from " + JOIN_ITEM_TABLE_FULL_NAME + " i")
 .explainIs("PhoenixToEnumerableConverter\n" +
"  PhoenixServerProject(item_id=[$0], NAME=[$1], 
EXPR$2=[$8])\n" +
-

phoenix git commit: PHOENIX-1878Implement PhoenixSchema and PhoenixTable in Phoenix/Calcite Integration

2015-04-30 Thread maryannxue
Repository: phoenix
Updated Branches:
  refs/heads/calcite 5cf992ef6 -> 8e3f68a2d


PHOENIX-1878Implement PhoenixSchema and PhoenixTable in Phoenix/Calcite 
Integration


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

Branch: refs/heads/calcite
Commit: 8e3f68a2da1473d62e69db6396232e6214c06201
Parents: 5cf992e
Author: maryannxue 
Authored: Thu Apr 30 12:40:29 2015 -0400
Committer: maryannxue 
Committed: Thu Apr 30 12:40:29 2015 -0400

--
 .../org/apache/phoenix/calcite/CalciteTest.java | 72 ++---
 .../apache/phoenix/calcite/CalciteUtils.java| 82 ++--
 .../apache/phoenix/calcite/PhoenixSchema.java   | 62 ++-
 3 files changed, 163 insertions(+), 53 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/8e3f68a2/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java 
b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
index 6b7065b..bff6706 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
@@ -647,6 +647,52 @@ public class CalciteTest extends BaseClientManagedTimeIT {
.close();
 }
 
+@Test public void testScalarSubquery() {
+start().sql("select \"item_id\", name, (select max(quantity) sq \n"
++ "from " + JOIN_ORDER_TABLE_FULL_NAME + " o where o.\"item_id\" = 
i.\"item_id\")\n"
++ "from " + JOIN_ITEM_TABLE_FULL_NAME + " i")
+.explainIs("PhoenixToEnumerableConverter\n" +
+   "  PhoenixServerProject(item_id=[$0], NAME=[$1], 
EXPR$2=[$8])\n" +
+   "PhoenixServerJoin(condition=[=($0, $7)], 
joinType=[left], isSingleValueRhs=[true])\n" +
+   "  PhoenixTableScan(table=[[phoenix, Join, 
ItemTable]])\n" +
+   "  PhoenixServerAggregate(group=[{0}], 
SQ=[MAX($1)])\n" +
+   "PhoenixServerProject(item_id0=[$7], 
QUANTITY=[$4])\n" +
+   "  PhoenixServerJoin(condition=[=($2, $7)], 
joinType=[inner])\n" +
+   "PhoenixTableScan(table=[[phoenix, Join, 
OrderTable]])\n" +
+   "PhoenixServerAggregate(group=[{0}])\n" +
+   "  PhoenixServerProject(item_id=[$0])\n" +
+   "PhoenixTableScan(table=[[phoenix, 
Join, ItemTable]])\n")
+.resultIs(new Object[][] {
+new Object[] {"01", "T1", 1000}, 
+new Object[] {"02", "T2", 3000}, 
+new Object[] {"03", "T3", 5000}, 
+new Object[] {"04", "T4", null}, 
+new Object[] {"05", "T5", null}, 
+new Object[] {"06", "T6", 4000}, 
+new Object[] {"invalid001", "INVALID-1", null}})
+.close();;
+start().sql("select \"item_id\", name, (select quantity sq \n"
++ "from " + JOIN_ORDER_TABLE_FULL_NAME + " o where 
o.\"item_id\" = i.\"item_id\")\n"
++ "from " + JOIN_ITEM_TABLE_FULL_NAME + " i where 
\"item_id\" < '06'")
+.explainIs("PhoenixToEnumerableConverter\n" +
+   "  PhoenixServerProject(item_id=[$0], 
NAME=[$1], EXPR$2=[$8])\n" +
+   "PhoenixServerJoin(condition=[=($0, $7)], 
joinType=[left], isSingleValueRhs=[true])\n" +
+   "  PhoenixTableScan(table=[[phoenix, Join, 
ItemTable]], filter=[<($0, '06')])\n" +
+   "  PhoenixServerProject(item_id0=[$7], 
SQ=[$4])\n" +
+   "PhoenixServerJoin(condition=[=($2, 
$7)], joinType=[inner])\n" +
+   "  PhoenixTableScan(table=[[p

phoenix git commit: Code refine for PhoenixSchema

2015-04-30 Thread maryannxue
Repository: phoenix
Updated Branches:
  refs/heads/calcite 8e3f68a2d -> 1ee1f2011


Code refine for PhoenixSchema


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

Branch: refs/heads/calcite
Commit: 1ee1f2011eda8a3b22c855e7730ed74b1bd628a9
Parents: 8e3f68a
Author: maryannxue 
Authored: Thu Apr 30 16:45:13 2015 -0400
Committer: maryannxue 
Committed: Thu Apr 30 16:45:13 2015 -0400

--
 .../apache/phoenix/calcite/PhoenixSchema.java   | 22 +++-
 1 file changed, 12 insertions(+), 10 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/1ee1f201/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixSchema.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixSchema.java 
b/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixSchema.java
index 816c156..589f61d 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixSchema.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixSchema.java
@@ -40,34 +40,36 @@ public class PhoenixSchema implements Schema {
 this.schemaName = name;
 this.pc = pc;
 this.client = new MetaDataClient(pc);
-this.subSchemaNames = Sets.newHashSet();
-this.tableNames = Sets.newHashSet();
-if (schemaName == null) {
-loadSubSchemaNames();
-}
-loadTableNames();
+this.subSchemaNames = name == null ? 
+  ImmutableSet. copyOf(loadSubSchemaNames()) 
+: Collections. emptySet();
+this.tableNames = ImmutableSet. copyOf(loadTableNames());
 }
 
-private void loadSubSchemaNames() {
+private Set loadSubSchemaNames() {
 try {
 DatabaseMetaData md = pc.getMetaData();
 ResultSet rs = md.getSchemas();
+Set subSchemaNames = Sets.newHashSet();
 while (rs.next()) {
 String schemaName = 
rs.getString(PhoenixDatabaseMetaData.TABLE_SCHEM);
-this.subSchemaNames.add(schemaName == null ? "" : schemaName);
+subSchemaNames.add(schemaName == null ? "" : schemaName);
 }
+return subSchemaNames;
 } catch (SQLException e) {
 throw new RuntimeException(e);
 }
 }
 
-private void loadTableNames() {
+private Set loadTableNames() {
 try {
 DatabaseMetaData md = pc.getMetaData();
 ResultSet rs = md.getTables(null, schemaName == null ? "" : 
schemaName, null, null);
+Set tableNames = Sets.newHashSet();
 while (rs.next()) {
-
this.tableNames.add(rs.getString(PhoenixDatabaseMetaData.TABLE_NAME));
+
tableNames.add(rs.getString(PhoenixDatabaseMetaData.TABLE_NAME));
 }
+return tableNames;
 } catch (SQLException e) {
 throw new RuntimeException(e);
 }



phoenix git commit: PHOENIX-1786 Implement sort-merge-join with Calcite integration

2015-04-30 Thread maryannxue
Repository: phoenix
Updated Branches:
  refs/heads/calcite 1ee1f2011 -> 53dab808a


PHOENIX-1786 Implement sort-merge-join with Calcite integration


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

Branch: refs/heads/calcite
Commit: 53dab808a0593b86e50a0f7c42c9a39d25b95e06
Parents: 1ee1f20
Author: maryannxue 
Authored: Thu Apr 30 23:46:02 2015 -0400
Committer: maryannxue 
Committed: Thu Apr 30 23:46:02 2015 -0400

--
 .../org/apache/phoenix/calcite/CalciteTest.java |  27 +++-
 .../apache/phoenix/calcite/CalciteUtils.java|  70 +++-
 .../calcite/rel/PhoenixAbstractJoin.java|  23 +++
 .../phoenix/calcite/rel/PhoenixClientJoin.java  |  67 +++-
 .../phoenix/calcite/rel/PhoenixServerJoin.java  |  24 +--
 .../calcite/rules/PhoenixConverterRules.java| 158 +--
 6 files changed, 317 insertions(+), 52 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/53dab808/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java 
b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
index bff6706..acb02f3 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
@@ -306,15 +306,26 @@ public class CalciteTest extends BaseClientManagedTimeIT {
 }
 
 @Test public void testClientJoin() throws Exception {
-start().sql("SELECT item.\"item_id\", item.name, supp.\"supplier_id\", 
supp.name FROM " + JOIN_ITEM_TABLE_FULL_NAME + " item FULL OUTER JOIN " + 
JOIN_SUPPLIER_TABLE_FULL_NAME + " supp ON item.\"supplier_id\" = 
supp.\"supplier_id\"")
+start().sql("SELECT item.\"item_id\", item.name, supp.\"supplier_id\", 
supp.name FROM " + JOIN_ITEM_TABLE_FULL_NAME + " item FULL OUTER JOIN " + 
JOIN_SUPPLIER_TABLE_FULL_NAME + " supp ON item.\"supplier_id\" = 
supp.\"supplier_id\" order by \"item_id\", supp.name")
 .explainIs("PhoenixToEnumerableConverter\n" +
-   "  PhoenixClientProject(item_id=[$0], NAME=[$1], 
supplier_id=[$3], NAME0=[$4])\n" +
-   "PhoenixClientJoin(condition=[=($2, $3)], 
joinType=[full])\n" +
-   "  PhoenixServerSort(sort0=[$2], dir0=[ASC])\n" 
+
-   "PhoenixServerProject(item_id=[$0], 
NAME=[$1], supplier_id=[$5])\n" +
-   "  PhoenixTableScan(table=[[phoenix, Join, 
ItemTable]])\n" +
-   "  PhoenixServerProject(supplier_id=[$0], 
NAME=[$1])\n" +
-   "PhoenixTableScan(table=[[phoenix, Join, 
SupplierTable]])\n")
+   "  PhoenixClientSort(sort0=[$0], sort1=[$3], 
dir0=[ASC], dir1=[ASC])\n" +
+   "PhoenixClientProject(item_id=[$0], NAME=[$1], 
supplier_id=[$3], NAME0=[$4])\n" +
+   "  PhoenixClientJoin(condition=[=($2, $3)], 
joinType=[full])\n" +
+   "PhoenixServerSort(sort0=[$2], 
dir0=[ASC])\n" +
+   "  PhoenixServerProject(item_id=[$0], 
NAME=[$1], supplier_id=[$5])\n" +
+   "PhoenixTableScan(table=[[phoenix, 
Join, ItemTable]])\n" +
+   "PhoenixServerProject(supplier_id=[$0], 
NAME=[$1])\n" +
+   "  PhoenixTableScan(table=[[phoenix, Join, 
SupplierTable]])\n")
+.resultIs(new Object[][] {
+{null, null, "03", "S3"},
+{null, null, "04", "S4"},
+{"01", "T1", "01", "S1"},
+{"02", "T2", "01", "S1"},
+{"03", "T3", "02", "S2"},
+{"04", "T4", "02", "S2"},
+{"05", "T5&q

[4/4] phoenix git commit: Add server/client conventions for PhoenixRel and use ConvertRules to apply Phoenix server/client operators

2015-06-10 Thread maryannxue
Add server/client conventions for PhoenixRel and use ConvertRules to apply 
Phoenix server/client operators


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

Branch: refs/heads/calcite
Commit: f2d95da77205384df21bfe277693602afddf276a
Parents: c1396ec
Author: maryannxue 
Authored: Wed Jun 10 16:46:57 2015 -0400
Committer: maryannxue 
Committed: Wed Jun 10 16:46:57 2015 -0400

--
 .../org/apache/phoenix/calcite/rel/PhoenixClientAggregate.java | 2 --
 .../java/org/apache/phoenix/calcite/rel/PhoenixClientProject.java  | 2 --
 .../java/org/apache/phoenix/calcite/rel/PhoenixClientSort.java | 1 -
 .../org/apache/phoenix/calcite/rel/PhoenixCompactClientSort.java   | 1 -
 .../main/java/org/apache/phoenix/calcite/rel/PhoenixFilter.java| 1 -
 .../src/main/java/org/apache/phoenix/calcite/rel/PhoenixLimit.java | 2 --
 .../org/apache/phoenix/calcite/rel/PhoenixPostJoinProject.java | 2 --
 .../org/apache/phoenix/calcite/rel/PhoenixServerAggregate.java | 2 --
 .../java/org/apache/phoenix/calcite/rel/PhoenixServerProject.java  | 2 --
 .../java/org/apache/phoenix/calcite/rel/PhoenixServerSort.java | 1 -
 10 files changed, 16 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/f2d95da7/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixClientAggregate.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixClientAggregate.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixClientAggregate.java
index db3de2c..7e9ff90 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixClientAggregate.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixClientAggregate.java
@@ -55,8 +55,6 @@ public class PhoenixClientAggregate extends 
PhoenixAbstractAggregate {
 
 @Override
 public QueryPlan implement(Implementor implementor) {
-assert getConvention() == getInput().getConvention();
-
 QueryPlan plan = implementor.visitInput(0, (PhoenixRel) getInput());
 
 TableRef tableRef = implementor.getTableRef();

http://git-wip-us.apache.org/repos/asf/phoenix/blob/f2d95da7/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixClientProject.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixClientProject.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixClientProject.java
index ecdbc3b..4cbf4d0 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixClientProject.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixClientProject.java
@@ -53,8 +53,6 @@ public class PhoenixClientProject extends 
PhoenixAbstractProject {
 
 @Override
 public QueryPlan implement(Implementor implementor) {
-assert getConvention() == getInput().getConvention();
-
 QueryPlan plan = implementor.visitInput(0, (PhoenixRel) getInput());   
 
 TupleProjector tupleProjector = project(implementor);
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/f2d95da7/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixClientSort.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixClientSort.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixClientSort.java
index 052f078..ab9dfd2 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixClientSort.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixClientSort.java
@@ -50,7 +50,6 @@ public class PhoenixClientSort extends PhoenixAbstractSort {
 
 @Override
 public QueryPlan implement(Implementor implementor) {
-assert getConvention() == getInput().getConvention();
 if (this.offset != null)
 throw new UnsupportedOperationException();
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/f2d95da7/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixCompactClientSort.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixCompactClientSort.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixCompactClientSort.java
index 39d7d08..81b5608 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel

[2/4] phoenix git commit: Add server/client conventions for PhoenixRel and use ConvertRules to apply Phoenix server/client operators

2015-06-10 Thread maryannxue
http://git-wip-us.apache.org/repos/asf/phoenix/blob/c1396ecf/phoenix-core/src/main/java/org/apache/phoenix/calcite/rules/PhoenixConverterRules.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/calcite/rules/PhoenixConverterRules.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/calcite/rules/PhoenixConverterRules.java
index 7748709..dee433c 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/calcite/rules/PhoenixConverterRules.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/calcite/rules/PhoenixConverterRules.java
@@ -1,19 +1,27 @@
 package org.apache.phoenix.calcite.rules;
 
 import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
 import java.util.logging.Logger;
 
 import org.apache.calcite.adapter.enumerable.EnumerableConvention;
 import org.apache.calcite.plan.Convention;
 import org.apache.calcite.plan.RelOptRule;
 import org.apache.calcite.plan.RelTrait;
+import org.apache.calcite.rel.RelCollation;
+import org.apache.calcite.rel.RelCollations;
+import org.apache.calcite.rel.RelFieldCollation;
 import org.apache.calcite.rel.RelNode;
+import org.apache.calcite.rel.RelFieldCollation.Direction;
 import org.apache.calcite.rel.convert.ConverterRule;
 import org.apache.calcite.rel.core.Aggregate;
 import org.apache.calcite.rel.core.Aggregate.Group;
 import org.apache.calcite.rel.core.AggregateCall;
 import org.apache.calcite.rel.core.Filter;
 import org.apache.calcite.rel.core.Join;
+import org.apache.calcite.rel.core.JoinInfo;
+import org.apache.calcite.rel.core.JoinRelType;
 import org.apache.calcite.rel.core.Project;
 import org.apache.calcite.rel.core.Sort;
 import org.apache.calcite.rel.core.Union;
@@ -28,17 +36,24 @@ import org.apache.calcite.util.trace.CalciteTrace;
 import org.apache.phoenix.calcite.CalciteUtils;
 import org.apache.phoenix.calcite.rel.PhoenixAbstractAggregate;
 import org.apache.phoenix.calcite.rel.PhoenixClientAggregate;
+import org.apache.phoenix.calcite.rel.PhoenixClientJoin;
 import org.apache.phoenix.calcite.rel.PhoenixClientProject;
 import org.apache.phoenix.calcite.rel.PhoenixClientSort;
 import org.apache.phoenix.calcite.rel.PhoenixFilter;
-import org.apache.phoenix.calcite.rel.PhoenixJoin;
 import org.apache.phoenix.calcite.rel.PhoenixLimit;
+import org.apache.phoenix.calcite.rel.PhoenixPostJoinProject;
 import org.apache.phoenix.calcite.rel.PhoenixRel;
+import org.apache.phoenix.calcite.rel.PhoenixServerAggregate;
+import org.apache.phoenix.calcite.rel.PhoenixServerJoin;
+import org.apache.phoenix.calcite.rel.PhoenixServerProject;
+import org.apache.phoenix.calcite.rel.PhoenixServerSort;
+import org.apache.phoenix.calcite.rel.PhoenixToClientConverter;
 import org.apache.phoenix.calcite.rel.PhoenixToEnumerableConverter;
 import org.apache.phoenix.calcite.rel.PhoenixUnion;
 
 import com.google.common.base.Predicate;
 import com.google.common.base.Predicates;
+import com.google.common.collect.Lists;
 
 /**
  * Rules and relational operators for
@@ -52,13 +67,22 @@ public class PhoenixConverterRules {
 
 public static final RelOptRule[] RULES = {
 PhoenixToEnumerableConverterRule.INSTANCE,
-PhoenixSortRule.INSTANCE,
+PhoenixServerToClientConverterRule.INSTANCE,
+PhoenixProjectableToClientConverterRule.INSTANCE,
+PhoenixClientSortRule.INSTANCE,
+PhoenixServerSortRule.SERVER,
+PhoenixServerSortRule.PROJECTABLE,
 PhoenixLimitRule.INSTANCE,
 PhoenixFilterRule.INSTANCE,
-PhoenixProjectRule.INSTANCE,
-PhoenixAggregateRule.INSTANCE,
+PhoenixClientProjectRule.INSTANCE,
+PhoenixServerProjectRule.INSTANCE,
+PhoenixPostJoinProjectRule.INSTANCE,
+PhoenixClientAggregateRule.INSTANCE,
+PhoenixServerAggregateRule.SERVER,
+PhoenixServerAggregateRule.PROJECTABLE,
 PhoenixUnionRule.INSTANCE,
-PhoenixJoinRule.INSTANCE,
+PhoenixClientJoinRule.INSTANCE,
+PhoenixServerJoinRule.INSTANCE,
 };
 
 /** Base class for planner rules that convert a relational expression to
@@ -89,36 +113,82 @@ public class PhoenixConverterRules {
  * Rule to convert a {@link org.apache.calcite.rel.core.Sort} to a
  * {@link PhoenixClientSort}.
  */
-private static class PhoenixSortRule extends PhoenixConverterRule {
-private static Predicate IS_CONVERTIBLE = new 
Predicate() {
+private static class PhoenixClientSortRule extends PhoenixConverterRule {
+
+private static Predicate IS_CONVERTIBLE = new Predicate() {
 @Override
-public boolean apply(LogicalSort input) {
+public boolean apply(Sort input) {
 return isConvertible(input);
 }
 };
-private static Predicate SORT_ONLY = new 
Predicate() {
+
+private static Predicate SORT_ONLY = new Predicate() {
 @Over

[1/4] phoenix git commit: Adjust cost of Project

2015-06-10 Thread maryannxue
Repository: phoenix
Updated Branches:
  refs/heads/calcite 53dab808a -> f2d95da77


Adjust cost of Project


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

Branch: refs/heads/calcite
Commit: cedc1c502b177824a476622294d8699f5637e327
Parents: 53dab80
Author: maryannxue 
Authored: Tue Jun 2 15:14:43 2015 -0400
Committer: maryannxue 
Committed: Tue Jun 2 15:14:43 2015 -0400

--
 .../org/apache/phoenix/calcite/CalciteTest.java |  4 ++--
 .../apache/phoenix/calcite/PhoenixSchema.java   |  3 +++
 .../calcite/metadata/PhoenixRelMdRowCount.java  |  7 +-
 .../calcite/rel/PhoenixAbstractProject.java | 12 ++
 .../phoenix/calcite/rel/PhoenixClientJoin.java  | 24 
 .../phoenix/calcite/rel/PhoenixServerJoin.java  | 21 +
 6 files changed, 44 insertions(+), 27 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/cedc1c50/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java 
b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
index acb02f3..89006ed 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
@@ -623,8 +623,8 @@ public class CalciteTest extends BaseClientManagedTimeIT {
 
 start().sql("SELECT item.\"item_id\", item.name, supp.\"supplier_id\", 
supp.name FROM " + JOIN_ITEM_TABLE_FULL_NAME + " item JOIN " + 
JOIN_SUPPLIER_TABLE_FULL_NAME + " supp ON item.\"supplier_id\" = 
supp.\"supplier_id\" limit 3")
 .explainIs("PhoenixToEnumerableConverter\n" +
-   "  PhoenixClientProject(item_id=[$0], NAME=[$1], 
supplier_id=[$3], NAME0=[$4])\n" +
-   "PhoenixLimit(fetch=[3])\n" +
+   "  PhoenixLimit(fetch=[3])\n" +
+   "PhoenixServerProject(item_id=[$0], NAME=[$1], 
supplier_id=[$3], NAME0=[$4])\n" +
"  PhoenixServerJoin(condition=[=($2, $3)], 
joinType=[inner])\n" +
"PhoenixServerProject(item_id=[$0], 
NAME=[$1], supplier_id=[$5])\n" +
"  PhoenixTableScan(table=[[phoenix, Join, 
ItemTable]])\n" +

http://git-wip-us.apache.org/repos/asf/phoenix/blob/cedc1c50/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixSchema.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixSchema.java 
b/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixSchema.java
index 589f61d..5fb407b 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixSchema.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixSchema.java
@@ -82,11 +82,14 @@ public class PhoenixSchema implements Schema {
 properties.setProperty(entry.getKey(), 
String.valueOf(entry.getValue()));
 }
 try {
+Class.forName("org.apache.phoenix.jdbc.PhoenixDriver");
 final Connection connection =
 DriverManager.getConnection(url, properties);
 final PhoenixConnection phoenixConnection =
 connection.unwrap(PhoenixConnection.class);
 return new PhoenixSchema(null, phoenixConnection);
+} catch (ClassNotFoundException e) {
+throw new RuntimeException(e);
 } catch (SQLException e) {
 throw new RuntimeException(e);
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/cedc1c50/phoenix-core/src/main/java/org/apache/phoenix/calcite/metadata/PhoenixRelMdRowCount.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/calcite/metadata/PhoenixRelMdRowCount.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/calcite/metadata/PhoenixRelMdRowCount.java
index a9b5274..23108b2 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/calcite/metadata/PhoenixRelMdRowCount.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/calcite/metadata/PhoenixRelMdRowCount.java
@@ -7,7 +7,6 @@ import org.apache.calcite.rel.metadata.RelMetadataQuery;
 import org.apache.calcite.util.BuiltInMethod;
 import org.apache

[3/4] phoenix git commit: Add server/client conventions for PhoenixRel and use ConvertRules to apply Phoenix server/client operators

2015-06-10 Thread maryannxue
Add server/client conventions for PhoenixRel and use ConvertRules to apply 
Phoenix server/client operators


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

Branch: refs/heads/calcite
Commit: c1396ecfff867d059cb0eb424188ffbfdbfd54f0
Parents: cedc1c5
Author: maryannxue 
Authored: Wed Jun 10 16:29:15 2015 -0400
Committer: maryannxue 
Committed: Wed Jun 10 16:29:15 2015 -0400

--
 .../org/apache/phoenix/calcite/CalciteTest.java | 268 -
 .../calcite/jdbc/PhoenixPrepareImpl.java|  18 +-
 .../calcite/metadata/PhoenixRelMdCollation.java |   4 -
 .../calcite/rel/PhoenixAbstractAggregate.java   |   1 -
 .../calcite/rel/PhoenixAbstractJoin.java|   3 +-
 .../calcite/rel/PhoenixAbstractProject.java |   1 -
 .../calcite/rel/PhoenixAbstractSort.java|   1 -
 .../calcite/rel/PhoenixClientAggregate.java |   2 +-
 .../phoenix/calcite/rel/PhoenixClientJoin.java  |  42 +-
 .../calcite/rel/PhoenixClientProject.java   |   2 +-
 .../phoenix/calcite/rel/PhoenixClientSort.java  |   2 +-
 .../calcite/rel/PhoenixCompactClientSort.java   |   2 +-
 .../phoenix/calcite/rel/PhoenixFilter.java  |   3 +-
 .../apache/phoenix/calcite/rel/PhoenixJoin.java |  49 ---
 .../phoenix/calcite/rel/PhoenixLimit.java   |   3 +-
 .../calcite/rel/PhoenixPostJoinProject.java |  70 
 .../apache/phoenix/calcite/rel/PhoenixRel.java  |   6 +-
 .../calcite/rel/PhoenixServerAggregate.java |   2 +-
 .../phoenix/calcite/rel/PhoenixServerJoin.java  |  10 +-
 .../calcite/rel/PhoenixServerProject.java   |   9 +-
 .../phoenix/calcite/rel/PhoenixServerSort.java  |   2 +-
 .../phoenix/calcite/rel/PhoenixTableScan.java   |   2 +-
 .../calcite/rel/PhoenixToClientConverter.java   |  45 +++
 .../phoenix/calcite/rel/PhoenixUnion.java   |   3 +-
 .../phoenix/calcite/rel/PhoenixValues.java  |   3 +-
 .../calcite/rules/PhoenixClientJoinRule.java|  40 --
 .../calcite/rules/PhoenixConverterRules.java| 388 ---
 .../rules/PhoenixFilterScanMergeRule.java   |   6 +-
 .../rules/PhoenixServerAggregateRule.java   |  39 --
 .../calcite/rules/PhoenixServerJoinRule.java|  54 ---
 .../calcite/rules/PhoenixServerProjectRule.java |  34 --
 .../calcite/rules/PhoenixServerSortRule.java|  38 --
 32 files changed, 653 insertions(+), 499 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/c1396ecf/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java 
b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
index 89006ed..dca783d 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
@@ -238,7 +238,8 @@ public class CalciteTest extends BaseClientManagedTimeIT {
 @Test public void testTableScan() throws Exception {
 start().sql("select * from aTable where a_string = 'a'")
 .explainIs("PhoenixToEnumerableConverter\n" +
-   "  PhoenixTableScan(table=[[phoenix, ATABLE]], 
filter=[=($2, 'a')])\n")
+   "  PhoenixToClientConverter\n" +
+   "PhoenixTableScan(table=[[phoenix, ATABLE]], 
filter=[=($2, 'a')])\n")
 .resultIs(new Object[][] {
   {"00D3XHP", "00A123122312312", "a"}, 
   {"00D3XHP", "00A223122312312", "a"}, 
@@ -250,8 +251,9 @@ public class CalciteTest extends BaseClientManagedTimeIT {
 @Test public void testProject() throws Exception {
 start().sql("select entity_id, a_string, organization_id from aTable 
where a_string = 'a'")
 .explainIs("PhoenixToEnumerableConverter\n" +
-   "  PhoenixServerProject(ENTITY_ID=[$1], 
A_STRING=[$2], ORGANIZATION_ID=[$0])\n" +
-   "PhoenixTableScan(table=[[phoenix, ATABLE]], 
filter=[=($2, 'a')])\n")
+   "  PhoenixToClientConverter\n" +
+   "PhoenixServerProject(ENTITY_ID=[$1], 
A_STRING=[$2], ORGANIZATION_ID=[$0])\n" +
+   "  PhoenixTableScan(table=[[phoenix, ATABLE]], 
filter=[=($2, 'a')])\n")

phoenix git commit: PHOENIX-1843 Implement getCollations() in PhoenixTable.getStatistics() and all other PhoenixRel nodes

2015-06-10 Thread maryannxue
Repository: phoenix
Updated Branches:
  refs/heads/calcite f2d95da77 -> 59d05d3a2


PHOENIX-1843 Implement getCollations() in PhoenixTable.getStatistics() and all 
other PhoenixRel nodes


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

Branch: refs/heads/calcite
Commit: 59d05d3a2685821f67124b7e407394354c4d9cc3
Parents: f2d95da
Author: maryannxue 
Authored: Wed Jun 10 21:02:02 2015 -0400
Committer: maryannxue 
Committed: Wed Jun 10 21:02:02 2015 -0400

--
 .../org/apache/phoenix/calcite/CalciteTest.java | 28 
 .../calcite/metadata/PhoenixRelMdCollation.java |  4 +--
 2 files changed, 29 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/59d05d3a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java 
b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
index dca783d..2774aa1 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
@@ -360,6 +360,34 @@ public class CalciteTest extends BaseClientManagedTimeIT {
 .close();
 }
 
+@Test public void testJoinPlanningWithCollation() throws Exception { 
+// Server-join with LHS sorted on order-by fields
+start().sql("SELECT item.\"item_id\", item.name, supp.\"supplier_id\", 
supp.name FROM " + JOIN_ITEM_TABLE_FULL_NAME + " item JOIN " + 
JOIN_SUPPLIER_TABLE_FULL_NAME + " supp ON item.\"supplier_id\" = 
supp.\"supplier_id\" order by supp.\"supplier_id\"")
+.explainIs("PhoenixToEnumerableConverter\n" +
+   "  PhoenixToClientConverter\n" +
+   "PhoenixPostJoinProject(item_id=[$2], 
NAME=[$3], supplier_id=[$0], NAME0=[$1])\n" +
+   "  PhoenixServerJoin(condition=[=($4, $0)], 
joinType=[inner])\n" +
+   "PhoenixServerProject(supplier_id=[$0], 
NAME=[$1])\n" +
+   "  PhoenixTableScan(table=[[phoenix, Join, 
SupplierTable]])\n" +
+   "PhoenixToClientConverter\n" +
+   "  PhoenixServerProject(item_id=[$0], 
NAME=[$1], supplier_id=[$5])\n" +
+   "PhoenixTableScan(table=[[phoenix, 
Join, ItemTable]])\n")
+.close();
+
+// Join key being order-by fields with the other side sorted on 
order-by fields
+start().sql("SELECT item.\"item_id\", item.name, supp.\"supplier_id\", 
supp.name FROM " + JOIN_ITEM_TABLE_FULL_NAME + " item JOIN " + 
JOIN_SUPPLIER_TABLE_FULL_NAME + " supp ON item.\"supplier_id\" = 
supp.\"supplier_id\" order by item.\"supplier_id\"")
+.explainIs("PhoenixToEnumerableConverter\n" +
+   "  PhoenixClientProject(item_id=[$0], NAME=[$1], 
supplier_id=[$3], NAME0=[$4])\n" +
+   "PhoenixClientJoin(condition=[=($2, $3)], 
joinType=[inner])\n" +
+   "  PhoenixServerSort(sort0=[$2], dir0=[ASC])\n" 
+
+   "PhoenixServerProject(item_id=[$0], 
NAME=[$1], supplier_id=[$5])\n" +
+   "  PhoenixTableScan(table=[[phoenix, Join, 
ItemTable]])\n" +
+   "  PhoenixToClientConverter\n" +
+   "PhoenixServerProject(supplier_id=[$0], 
NAME=[$1])\n" +
+   "  PhoenixTableScan(table=[[phoenix, Join, 
SupplierTable]])\n")
+.close();
+}
+
 @Test public void testMultiJoin() throws Exception {
 start().sql("select t1.entity_id, t2.a_string, t3.organization_id from 
aTable t1 join aTable t2 on t1.entity_id = t2.entity_id and t1.organization_id 
= t2.organization_id join atable t3 on t1.entity_id = t3.entity_id and 
t1.organization_id = t3.organization_id where t1.a_string = 'a'") 
 .explainIs("PhoenixToEnumerableConverter\n" +

http://git-wip-us.apache.org/repos/asf/phoenix/blob/59d05d3a/phoenix-core/sr

phoenix git commit: Upgrade Calcite dependence to 1.3-incubating

2015-06-11 Thread maryannxue
Repository: phoenix
Updated Branches:
  refs/heads/calcite 59d05d3a2 -> 2e5a91875


Upgrade Calcite dependence to 1.3-incubating


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

Branch: refs/heads/calcite
Commit: 2e5a91875e61c571a61f82f7268913d8acc06956
Parents: 59d05d3
Author: maryannxue 
Authored: Thu Jun 11 16:58:30 2015 -0400
Committer: maryannxue 
Committed: Thu Jun 11 16:58:30 2015 -0400

--
 .../org/apache/phoenix/calcite/CalciteTest.java | 132 +--
 .../calcite/rel/PhoenixAbstractAggregate.java   |  23 ++--
 ...hoenixJoinSingleValueAggregateMergeRule.java |  19 ++-
 pom.xml |   4 +-
 4 files changed, 89 insertions(+), 89 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/2e5a9187/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java 
b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
index 2774aa1..96c3d96 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
@@ -435,9 +435,8 @@ public class CalciteTest extends BaseClientManagedTimeIT {
 @Test public void testAggregate() {
 start().sql("select a_string, count(entity_id) from atable group by 
a_string")
 .explainIs("PhoenixToEnumerableConverter\n" +
-   "  PhoenixServerAggregate(group=[{0}], 
EXPR$1=[COUNT()])\n" +
-   "PhoenixServerProject(A_STRING=[$2])\n" +
-   "  PhoenixTableScan(table=[[phoenix, 
ATABLE]])\n")
+   "  PhoenixServerAggregate(group=[{2}], 
EXPR$1=[COUNT()])\n" +
+   "PhoenixTableScan(table=[[phoenix, ATABLE]])\n")
 .resultIs(new Object[][] {
   {"a", 4L},
   {"b", 4L},
@@ -447,9 +446,8 @@ public class CalciteTest extends BaseClientManagedTimeIT {
 start().sql("select count(entity_id), a_string from atable group by 
a_string")
 .explainIs("PhoenixToEnumerableConverter\n" +
"  PhoenixClientProject(EXPR$0=[$1], 
A_STRING=[$0])\n" +
-   "PhoenixServerAggregate(group=[{0}], 
EXPR$0=[COUNT()])\n" +
-   "  PhoenixServerProject(A_STRING=[$2])\n" +
-   "PhoenixTableScan(table=[[phoenix, 
ATABLE]])\n")
+   "PhoenixServerAggregate(group=[{2}], 
EXPR$0=[COUNT()])\n" +
+   "  PhoenixTableScan(table=[[phoenix, 
ATABLE]])\n")
 .resultIs(new Object[][] {
   {4L, "a"},
   {4L, "b"},
@@ -458,14 +456,13 @@ public class CalciteTest extends BaseClientManagedTimeIT {
 
 start().sql("select s.name, count(\"item_id\") from " + 
JOIN_SUPPLIER_TABLE_FULL_NAME + " s join " + JOIN_ITEM_TABLE_FULL_NAME + " i on 
s.\"supplier_id\" = i.\"supplier_id\" group by s.name")
 .explainIs("PhoenixToEnumerableConverter\n" +
-   "  PhoenixServerAggregate(group=[{0}], 
EXPR$1=[COUNT()])\n" +
-   "PhoenixPostJoinProject(NAME=[$2])\n" +
-   "  PhoenixServerJoin(condition=[=($1, $0)], 
joinType=[inner])\n" +
-   "PhoenixServerProject(supplier_id=[$5])\n" +
-   "  PhoenixTableScan(table=[[phoenix, Join, 
ItemTable]])\n" +
-   "PhoenixToClientConverter\n" +
-   "  PhoenixServerProject(supplier_id=[$0], 
NAME=[$1])\n" +
-   "PhoenixTableScan(table=[[phoenix, 
Join, SupplierTable]])\n")
+   "  PhoenixServerAggregate(group=[{2}], 
EXPR$1=[COUNT()])\n" +
+   "PhoenixServerJoin(condition=[=($1, $0)], 
joinType=[inner])\n" +
+   "  PhoenixServerProject(supplier_id=[$5])\n" +
+   

phoenix git commit: PHOENIX-1839 Enable hash-join with RIGHT OUTER joins

2015-06-11 Thread maryannxue
Repository: phoenix
Updated Branches:
  refs/heads/calcite 2e5a91875 -> 171cc9249


PHOENIX-1839 Enable hash-join with RIGHT OUTER joins


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

Branch: refs/heads/calcite
Commit: 171cc92490ac405813c8809b82cac72ead64c5be
Parents: 2e5a918
Author: maryannxue 
Authored: Thu Jun 11 17:40:11 2015 -0400
Committer: maryannxue 
Committed: Thu Jun 11 17:40:11 2015 -0400

--
 .../org/apache/phoenix/calcite/CalciteTest.java | 23 
 .../calcite/jdbc/PhoenixPrepareImpl.java|  5 +
 2 files changed, 28 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/171cc924/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java 
b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
index 96c3d96..7ce4f49 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
@@ -313,6 +313,29 @@ public class CalciteTest extends BaseClientManagedTimeIT {
 .close();
 }
 
+@Test public void testRightOuterJoin() throws Exception {
+start().sql("SELECT item.\"item_id\", item.name, supp.\"supplier_id\", 
supp.name FROM " + JOIN_ITEM_TABLE_FULL_NAME + " item RIGHT OUTER JOIN " + 
JOIN_SUPPLIER_TABLE_FULL_NAME + " supp ON item.\"supplier_id\" = 
supp.\"supplier_id\"")
+.explainIs("PhoenixToEnumerableConverter\n" +
+   "  PhoenixToClientConverter\n" +
+   "PhoenixPostJoinProject(item_id=[$2], 
NAME=[$3], supplier_id=[$0], NAME0=[$1])\n" +
+   "  PhoenixServerJoin(condition=[=($4, $0)], 
joinType=[left])\n" +
+   "PhoenixServerProject(supplier_id=[$0], 
NAME=[$1])\n" +
+   "  PhoenixTableScan(table=[[phoenix, Join, 
SupplierTable]])\n" +
+   "PhoenixToClientConverter\n" +
+   "  PhoenixServerProject(item_id=[$0], 
NAME=[$1], supplier_id=[$5])\n" +
+   "PhoenixTableScan(table=[[phoenix, 
Join, ItemTable]])\n")
+.resultIs(new Object[][] {
+  {"01", "T1", "01", "S1"}, 
+  {"02", "T2", "01", "S1"}, 
+  {"03", "T3", "02", "S2"}, 
+  {"04", "T4", "02", "S2"},
+  {null, null, "03", "S3"}, 
+  {null, null, "04", "S4"}, 
+  {"05", "T5", "05", "S5"},
+  {"06", "T6", "06", "S6"}})
+.close();
+}
+
 @Test public void testClientJoin() throws Exception {
 start().sql("SELECT item.\"item_id\", item.name, supp.\"supplier_id\", 
supp.name FROM " + JOIN_ITEM_TABLE_FULL_NAME + " item FULL OUTER JOIN " + 
JOIN_SUPPLIER_TABLE_FULL_NAME + " supp ON item.\"supplier_id\" = 
supp.\"supplier_id\" order by \"item_id\", supp.name")
 .explainIs("PhoenixToEnumerableConverter\n" +

http://git-wip-us.apache.org/repos/asf/phoenix/blob/171cc924/phoenix-core/src/main/java/org/apache/phoenix/calcite/jdbc/PhoenixPrepareImpl.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/calcite/jdbc/PhoenixPrepareImpl.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/calcite/jdbc/PhoenixPrepareImpl.java
index 20e1943..01a8c7b 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/calcite/jdbc/PhoenixPrepareImpl.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/calcite/jdbc/PhoenixPrepareImpl.java
@@ -5,6 +5,7 @@ import org.apache.calcite.plan.RelOptCostFactory;
 import org.apache.calcite.plan.RelOptPl

phoenix git commit: PHOENIX-1829 Extend support for equi-join conditions

2015-06-12 Thread maryannxue
Repository: phoenix
Updated Branches:
  refs/heads/calcite 171cc9249 -> f9ddb988c


PHOENIX-1829 Extend support for equi-join conditions


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

Branch: refs/heads/calcite
Commit: f9ddb988cd7dca05a4d4aaa75264b505770f3061
Parents: 171cc92
Author: maryannxue 
Authored: Fri Jun 12 23:29:15 2015 -0400
Committer: maryannxue 
Committed: Fri Jun 12 23:29:15 2015 -0400

--
 .../org/apache/phoenix/calcite/CalciteTest.java |  15 +
 .../apache/phoenix/calcite/BuiltInMethod.java   |   3 +
 .../apache/phoenix/calcite/CalciteUtils.java| 353 ++-
 .../apache/phoenix/calcite/PhoenixTable.java|   1 +
 .../rel/PhoenixToEnumerableConverter.java   |   1 +
 5 files changed, 369 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/f9ddb988/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java 
b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
index 7ce4f49..ebd9dfb 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java
@@ -311,6 +311,21 @@ public class CalciteTest extends BaseClientManagedTimeIT {
 .resultIs(new Object[][] {
   {"05", "T5", 500, 8, 15, "05", "Item 
T5", "05", "S5", "888-888-", "505 YYY Street", "10005"}})
 .close();
+
+start().sql("SELECT \"order_id\", i.name, i.price, discount2, quantity 
FROM " + JOIN_ORDER_TABLE_FULL_NAME + " o INNER JOIN " 
++ JOIN_ITEM_TABLE_FULL_NAME + " i ON o.\"item_id\" = 
i.\"item_id\" AND o.price = (i.price * (100 - discount2)) / 100.0 WHERE 
quantity < 5000")
+.explainIs("PhoenixToEnumerableConverter\n" +
+   "  PhoenixToClientConverter\n" +
+   "PhoenixPostJoinProject(order_id=[$5], 
NAME=[$1], PRICE=[$2], DISCOUNT2=[$3], QUANTITY=[$7])\n" +
+   "  PhoenixServerJoin(condition=[AND(=($6, $0), 
=($8, $4))], joinType=[inner])\n" +
+   "PhoenixServerProject(item_id=[$0], 
NAME=[$1], PRICE=[$2], DISCOUNT2=[$4], $f7=[/(*($2, -(100, $4)), 100.0)])\n" +
+   "  PhoenixTableScan(table=[[phoenix, Join, 
ItemTable]])\n" +
+   "PhoenixToClientConverter\n" +
+   "  PhoenixServerProject(order_id=[$0], 
item_id=[$2], QUANTITY=[$4], $f7=[CAST($3):DECIMAL(17, 6) NOT NULL])\n" +
+   "PhoenixTableScan(table=[[phoenix, 
Join, OrderTable]], filter=[<($4, 5000)])\n")
+.resultIs(new Object[][] {
+  {"004", "T6", 600, 15, 4000}})
+.close();
 }
 
 @Test public void testRightOuterJoin() throws Exception {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/f9ddb988/phoenix-core/src/main/java/org/apache/phoenix/calcite/BuiltInMethod.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/calcite/BuiltInMethod.java 
b/phoenix-core/src/main/java/org/apache/phoenix/calcite/BuiltInMethod.java
index 192b421..3c0feeb 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/calcite/BuiltInMethod.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/calcite/BuiltInMethod.java
@@ -17,6 +17,7 @@ public enum BuiltInMethod {
 TO_ENUMERABLE(CalciteRuntime.class, "toEnumerable", QueryPlan.class);
 
 public final Method method;
+@SuppressWarnings("rawtypes")
 public final Constructor constructor;
 
 public static final ImmutableMap MAP;
@@ -32,11 +33,13 @@ public enum BuiltInMethod {
 MAP = builder.build();
 }
 
+@SuppressWarnings("rawtypes")
 BuiltInMethod(Class clazz, String methodName, Class... argumentTypes) {
 this.method = Types.lookupMethod(clazz, methodName, argumentTypes);
 this.constructor = null;
 }
 
+@SuppressWarnings("ra

[04/50] [abbrv] phoenix git commit: PHOENIX-1882 Issue column family deletes instead of row deletes in PTableImpl

2015-06-15 Thread maryannxue
PHOENIX-1882 Issue column family deletes instead of row deletes in PTableImpl


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

Branch: refs/heads/calcite
Commit: efd7c9f735433c8512877ad3db194bb325bdde32
Parents: d2c1f2c
Author: Thomas 
Authored: Sun Apr 26 11:38:51 2015 -0700
Committer: Thomas 
Committed: Wed Apr 29 20:48:06 2015 -0700

--
 .../phoenix/end2end/MappingTableDataTypeIT.java | 67 ++--
 .../apache/phoenix/index/IndexMaintainer.java   |  7 --
 .../org/apache/phoenix/schema/PTableImpl.java   |  8 +--
 3 files changed, 53 insertions(+), 29 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/efd7c9f7/phoenix-core/src/it/java/org/apache/phoenix/end2end/MappingTableDataTypeIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/MappingTableDataTypeIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/MappingTableDataTypeIT.java
index 98e536e..9617e37 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/MappingTableDataTypeIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/MappingTableDataTypeIT.java
@@ -19,23 +19,31 @@ package org.apache.phoenix.end2end;
 
 import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES;
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
 
 import java.io.IOException;
 import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
 import java.sql.SQLException;
+import java.util.List;
 import java.util.Properties;
 
 import org.apache.hadoop.hbase.HColumnDescriptor;
 import org.apache.hadoop.hbase.HTableDescriptor;
+import org.apache.hadoop.hbase.KeyValue;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.client.HTableInterface;
 import org.apache.hadoop.hbase.client.Put;
+import org.apache.hadoop.hbase.client.Result;
+import org.apache.hadoop.hbase.client.ResultScanner;
+import org.apache.hadoop.hbase.client.Scan;
 import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.phoenix.exception.SQLExceptionCode;
 import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.util.PropertiesUtil;
 import org.junit.Test;
@@ -52,18 +60,44 @@ public class MappingTableDataTypeIT extends 
BaseHBaseManagedTimeIT {
 try {
 // Create table then get the single region for our new table.
 HTableDescriptor descriptor = new HTableDescriptor(tableName);
-HColumnDescriptor columnDescriptor =  new 
HColumnDescriptor(Bytes.toBytes("cf"));
-descriptor.addFamily(columnDescriptor);
+HColumnDescriptor columnDescriptor1 =  new 
HColumnDescriptor(Bytes.toBytes("cf1"));
+HColumnDescriptor columnDescriptor2 =  new 
HColumnDescriptor(Bytes.toBytes("cf2"));
+descriptor.addFamily(columnDescriptor1);
+descriptor.addFamily(columnDescriptor2);
 admin.createTable(descriptor);
 HTableInterface t = 
conn.getQueryServices().getTable(Bytes.toBytes("MTEST"));
 insertData(tableName.getName(), admin, t);
 t.close();
-try {
-testCreateTableMismatchedType();
-fail();
-} catch (SQLException e) {
-
assertEquals(SQLExceptionCode.ILLEGAL_DATA.getErrorCode(),e.getErrorCode());
-}
+// create phoenix table that maps to existing HBase table
+createPhoenixTable();
+
+String selectSql = "SELECT * FROM MTEST";
+ResultSet rs = conn.createStatement().executeQuery(selectSql);
+ResultSetMetaData rsMetaData = rs.getMetaData();
+assertTrue("Expected single row", rs.next());
+// verify values from cf2 is not returned
+assertEquals("Number of columns", 2, rsMetaData.getColumnCount());
+assertEquals("Column Value", "value1", rs.getString(2));
+assertFalse("Expected single row ", rs.next());
+
+// delete the row
+String deleteSql = "DELETE FROM MTEST WHERE id = 'row'";
+conn.createStatement().executeUpdate(deleteSql);
+conn.commit();
+
+// verify that no rows are returned when querying through phoenix
+rs = co

[37/50] [abbrv] phoenix git commit: PHOENIX-2007 java.sql.SQLException: Encountered exception in sub plan [0] execution(Alicia Ying Shu)

2015-06-15 Thread maryannxue
PHOENIX-2007 java.sql.SQLException: Encountered exception in sub plan [0] 
execution(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/82df3b97
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/82df3b97
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/82df3b97

Branch: refs/heads/calcite
Commit: 82df3b97a9ca88605f78b59e547819ff3bf9cd7a
Parents: 583b5b1
Author: Rajeshbabu Chintaguntla 
Authored: Mon Jun 1 21:04:43 2015 +0530
Committer: Rajeshbabu Chintaguntla 
Committed: Mon Jun 1 21:04:43 2015 +0530

--
 .../org/apache/phoenix/end2end/HashJoinIT.java  | 54 
 .../apache/phoenix/execute/HashJoinPlan.java|  7 +--
 2 files changed, 58 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/82df3b97/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java
index a03204a..88e03ca 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java
@@ -3813,6 +3813,60 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT {
 }
 }
 
+@Test
+public void testSubqueryWithoutData() throws Exception {
+Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+Connection conn = DriverManager.getConnection(getUrl(), props);
+conn.setAutoCommit(false);
+
+try {
+String GRAMMAR_TABLE = "CREATE TABLE IF NOT EXISTS GRAMMAR_TABLE 
(ID INTEGER PRIMARY KEY, " +
+"unsig_id UNSIGNED_INT, big_id BIGINT, unsig_long_id 
UNSIGNED_LONG, tiny_id TINYINT," +
+"unsig_tiny_id UNSIGNED_TINYINT, small_id SMALLINT, 
unsig_small_id UNSIGNED_SMALLINT," + 
+"float_id FLOAT, unsig_float_id UNSIGNED_FLOAT, double_id 
DOUBLE, unsig_double_id UNSIGNED_DOUBLE," + 
+"decimal_id DECIMAL, boolean_id BOOLEAN, time_id TIME, 
date_id DATE, timestamp_id TIMESTAMP," + 
+"unsig_time_id TIME, unsig_date_id DATE, 
unsig_timestamp_id TIMESTAMP, varchar_id VARCHAR (30)," + 
+"char_id CHAR (30), binary_id BINARY (100), varbinary_id 
VARBINARY (100))";
+
+String LARGE_TABLE = "CREATE TABLE IF NOT EXISTS LARGE_TABLE (ID 
INTEGER PRIMARY KEY, " +
+"unsig_id UNSIGNED_INT, big_id BIGINT, unsig_long_id 
UNSIGNED_LONG, tiny_id TINYINT," +
+"unsig_tiny_id UNSIGNED_TINYINT, small_id SMALLINT, 
unsig_small_id UNSIGNED_SMALLINT," + 
+"float_id FLOAT, unsig_float_id UNSIGNED_FLOAT, double_id 
DOUBLE, unsig_double_id UNSIGNED_DOUBLE," + 
+"decimal_id DECIMAL, boolean_id BOOLEAN, time_id TIME, 
date_id DATE, timestamp_id TIMESTAMP," + 
+"unsig_time_id TIME, unsig_date_id DATE, 
unsig_timestamp_id TIMESTAMP, varchar_id VARCHAR (30)," + 
+"char_id CHAR (30), binary_id BINARY (100), varbinary_id 
VARBINARY (100))";
+
+String SECONDARY_LARGE_TABLE = "CREATE TABLE IF NOT EXISTS 
SECONDARY_LARGE_TABLE (SEC_ID INTEGER PRIMARY KEY," +
+"sec_unsig_id UNSIGNED_INT, sec_big_id BIGINT, 
sec_usnig_long_id UNSIGNED_LONG, sec_tiny_id TINYINT," + 
+"sec_unsig_tiny_id UNSIGNED_TINYINT, sec_small_id 
SMALLINT, sec_unsig_small_id UNSIGNED_SMALLINT," + 
+"sec_float_id FLOAT, sec_unsig_float_id UNSIGNED_FLOAT, 
sec_double_id DOUBLE, sec_unsig_double_id UNSIGNED_DOUBLE," +
+"sec_decimal_id DECIMAL, sec_boolean_id BOOLEAN, 
sec_time_id TIME, sec_date_id DATE," +
+"sec_timestamp_id TIMESTAMP, sec_unsig_time_id TIME, 
sec_unsig_date_id DATE, sec_unsig_timestamp_id TIMESTAMP," +
+"sec_varchar_id VARCHAR (30), sec_char_id CHAR (30), 
sec_binary_id BINARY (100), sec_varbinary_id VARBINARY (100))";
+createTestTable(getUrl(), GRAMMAR_TABLE);
+createTestTable(getUrl(), LARGE_TABLE);
+createTestTable(getUrl(), SECONDARY_LARGE_TABLE);
+
+String ddl = "SELECT * FROM (SELECT ID, BIG_ID, DATE_ID FROM 
LARGE_TABLE AS A WHERE (A.ID % 5) = 0) AS A " +
+"INNER JOIN (SELECT SEC_ID, SEC_TINY_ID, 
SEC_UNSIG_FLOAT_ID FROM SECONDARY_LARGE_TABLE AS B WHERE (B.SEC_ID % 5) = 0) AS 
B " + 
+"ON A.ID=B.SEC_ID WHERE A.DATE_ID > ALL (SELECT 
SEC_DATE_ID FROM SECONDARY_LARGE_TABLE LIMIT 100) " +  
+"AND B.SEC_UNSIG_FLOAT_ID = ANY (SELECT sec_unsig_float_id 
FRO

[30/50] [abbrv] phoenix git commit: PHOENIX-2005 Connection utilities omit zk client port, parent znode

2015-06-15 Thread maryannxue
PHOENIX-2005 Connection utilities omit zk client port, parent znode


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

Branch: refs/heads/calcite
Commit: afb0120e079502d926c5f37de4e28d3865e29089
Parents: a28c1d3
Author: Nick Dimiduk 
Authored: Tue May 26 11:11:48 2015 -0700
Committer: Nick Dimiduk 
Committed: Tue May 26 11:12:28 2015 -0700

--
 .../phoenix/jdbc/PhoenixEmbeddedDriver.java | 28 --
 .../phoenix/mapreduce/CsvBulkLoadTool.java  | 93 ++--
 .../phoenix/mapreduce/CsvToKeyValueMapper.java  | 26 +-
 .../query/ConnectionQueryServicesImpl.java  |  4 +-
 .../java/org/apache/phoenix/util/QueryUtil.java | 45 --
 .../phoenix/jdbc/PhoenixEmbeddedDriverTest.java | 14 ++-
 .../phoenix/mapreduce/CsvBulkLoadToolTest.java  | 11 ---
 .../mapreduce/CsvToKeyValueMapperTest.java  | 15 
 .../org/apache/phoenix/util/QueryUtilTest.java  | 33 ---
 9 files changed, 139 insertions(+), 130 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/afb0120e/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriver.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriver.java 
b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriver.java
index 9e95667..2451603 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriver.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriver.java
@@ -31,6 +31,7 @@ import java.util.logging.Logger;
 
 import javax.annotation.concurrent.Immutable;
 
+import org.apache.hadoop.hbase.HConstants;
 import org.apache.phoenix.coprocessor.MetaDataProtocol;
 import org.apache.phoenix.exception.SQLExceptionCode;
 import org.apache.phoenix.exception.SQLExceptionInfo;
@@ -174,10 +175,10 @@ public abstract class PhoenixEmbeddedDriver implements 
Driver, org.apache.phoeni
 }
 
 /**
- * 
+ *
  * Class to encapsulate connection info for HBase
  *
- * 
+ *
  * @since 0.1.1
  */
 public static class ConnectionInfo {
@@ -204,12 +205,18 @@ public abstract class PhoenixEmbeddedDriver implements 
Driver, org.apache.phoeni
 return false;
 }
 
-protected static ConnectionInfo create(String url) throws SQLException 
{
-StringTokenizer tokenizer = new StringTokenizer(url == null ? "" : 
url.substring(PhoenixRuntime.JDBC_PROTOCOL.length()),DELIMITERS, true);
+public static ConnectionInfo create(String url) throws SQLException {
+url = url == null ? "" : url;
+url = url.startsWith(PhoenixRuntime.JDBC_PROTOCOL)
+? url.substring(PhoenixRuntime.JDBC_PROTOCOL.length())
+: url;
+StringTokenizer tokenizer = new StringTokenizer(url, DELIMITERS, 
true);
 int nTokens = 0;
 String[] tokens = new String[5];
 String token = null;
-while (tokenizer.hasMoreTokens() && 
!(token=tokenizer.nextToken()).equals(TERMINATOR) && tokenizer.hasMoreTokens() 
&& nTokens < tokens.length) {
+while (tokenizer.hasMoreTokens() &&
+!(token=tokenizer.nextToken()).equals(TERMINATOR) &&
+tokenizer.hasMoreTokens() && nTokens < tokens.length) {
 token = tokenizer.nextToken();
 // This would mean we have an empty string for a token which 
is illegal
 if (DELIMITERS.contains(token)) {
@@ -316,8 +323,7 @@ public abstract class PhoenixEmbeddedDriver implements 
Driver, org.apache.phoeni
 private final String principal;
 private final String keytab;
 
-// used for testing
-ConnectionInfo(String zookeeperQuorum, Integer port, String rootNode, 
String principal, String keytab) {
+public ConnectionInfo(String zookeeperQuorum, Integer port, String 
rootNode, String principal, String keytab) {
 this.zookeeperQuorum = zookeeperQuorum;
 this.port = port;
 this.rootNode = rootNode;
@@ -326,8 +332,7 @@ public abstract class PhoenixEmbeddedDriver implements 
Driver, org.apache.phoeni
 this.keytab = keytab;
 }
 
-// used for testing
-ConnectionInfo(String zookeeperQuorum, Integer port, String rootNode) {
+public ConnectionInfo(String zookeeperQuorum, Integer port, String 
rootNode) {
this(zookeeperQuorum, port, rootNode, null, null);
 }
 
@@ -417,6 +422,11 @@ public abstract class PhoenixEmb

[10/50] [abbrv] phoenix git commit: PHOENIX-1956 SELECT (FALSE OR FALSE) RETURNS TRUE

2015-06-15 Thread maryannxue
PHOENIX-1956 SELECT (FALSE OR FALSE) RETURNS TRUE


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

Branch: refs/heads/calcite
Commit: c2fee39efff87930ab3a00d4ed36ec32a493cf7d
Parents: 45a919f
Author: James Taylor 
Authored: Fri May 8 13:13:44 2015 -0700
Committer: James Taylor 
Committed: Fri May 8 13:14:24 2015 -0700

--
 .../org/apache/phoenix/end2end/EvaluationOfORIT.java | 11 +++
 .../org/apache/phoenix/compile/ExpressionCompiler.java   |  3 +--
 2 files changed, 12 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/c2fee39e/phoenix-core/src/it/java/org/apache/phoenix/end2end/EvaluationOfORIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/EvaluationOfORIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/EvaluationOfORIT.java
index c9cc1e2..4355036 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/EvaluationOfORIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/EvaluationOfORIT.java
@@ -19,6 +19,7 @@ package org.apache.phoenix.end2end;
  
 import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES;
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
 import java.sql.Connection;
@@ -34,6 +35,16 @@ import org.junit.Test;
 
 public class EvaluationOfORIT extends BaseHBaseManagedTimeIT{

+@Test
+public void testFalseOrFalse() throws SQLException {
+Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+Connection conn = DriverManager.getConnection(getUrl(), props);
+ResultSet rs = conn.createStatement().executeQuery("SELECT (FALSE OR 
FALSE) AS B FROM SYSTEM.CATALOG LIMIT 1");
+assertTrue(rs.next());
+assertFalse(rs.getBoolean(1));
+conn.close();
+}
+
@Test
public void testPKOrNotPKInOREvaluation() throws SQLException {
Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/c2fee39e/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java 
b/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java
index 92899a6..66c1b85 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java
@@ -71,7 +71,6 @@ import 
org.apache.phoenix.expression.function.ArrayAnyComparisonExpression;
 import org.apache.phoenix.expression.function.ArrayElemRefExpression;
 import org.apache.phoenix.expression.function.RoundDecimalExpression;
 import org.apache.phoenix.expression.function.RoundTimestampExpression;
-import org.apache.phoenix.expression.function.UDFExpression;
 import org.apache.phoenix.parse.AddParseNode;
 import org.apache.phoenix.parse.AndParseNode;
 import org.apache.phoenix.parse.ArithmeticParseNode;
@@ -261,7 +260,7 @@ public class ExpressionCompiler extends 
UnsupportedAllParseNodeVisitor

[07/50] [abbrv] phoenix git commit: PHOENIX-1880 Connections from QueryUtil.getConnection don't work on secure clusters (Geoffrey Jacoby)

2015-06-15 Thread maryannxue
PHOENIX-1880 Connections from QueryUtil.getConnection don't work on secure 
clusters (Geoffrey Jacoby)


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

Branch: refs/heads/calcite
Commit: 1fa09dc5c84ca92f57f6904bf88628133eb65995
Parents: d223f2c
Author: James Taylor 
Authored: Thu Apr 30 13:39:23 2015 -0700
Committer: James Taylor 
Committed: Thu Apr 30 13:39:23 2015 -0700

--
 .../phoenix/mapreduce/util/ConnectionUtil.java  | 23 +++-
 .../org/apache/phoenix/util/PropertiesUtil.java | 22 +++
 .../java/org/apache/phoenix/util/QueryUtil.java |  4 
 .../apache/phoenix/util/PropertiesUtilTest.java | 23 +++-
 4 files changed, 51 insertions(+), 21 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/1fa09dc5/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 e677104..294d4e9 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
@@ -26,6 +26,7 @@ import java.util.Properties;
 
 import com.google.common.base.Preconditions;
 import org.apache.hadoop.conf.Configuration;
+import org.apache.phoenix.util.PropertiesUtil;
 import org.apache.phoenix.util.QueryUtil;
 
 /**
@@ -54,7 +55,7 @@ public class ConnectionUtil {
 public static Connection getInputConnection(final Configuration conf , 
final Properties props) throws SQLException {
 Preconditions.checkNotNull(conf);
 return getConnection(PhoenixConfigurationUtil.getInputCluster(conf),
-extractProperties(props, conf));
+PropertiesUtil.extractProperties(props, conf));
 }
 
 /**
@@ -77,7 +78,7 @@ public class ConnectionUtil {
 public static Connection getOutputConnection(final Configuration conf, 
Properties props) throws SQLException {
 Preconditions.checkNotNull(conf);
 return getConnection(PhoenixConfigurationUtil.getOutputCluster(conf),
-extractProperties(props, conf));
+PropertiesUtil.extractProperties(props, conf));
 }
 
 /**
@@ -91,22 +92,4 @@ public class ConnectionUtil {
 return DriverManager.getConnection(QueryUtil.getUrl(quorum), props);
 }
 
-/**
- * Add properties from the given Configuration to the provided Properties.
- *
- * @param props properties to which connection information from the 
Configuration will be added
- * @param conf configuration containing connection information
- * @return the input Properties value, with additional connection 
information from the
- * given Configuration
- */
-private static Properties extractProperties(Properties props, final 
Configuration conf) {
-Iterator> iterator = conf.iterator();
-if(iterator != null) {
-while (iterator.hasNext()) {
-Map.Entry entry = iterator.next();
-props.setProperty(entry.getKey(), entry.getValue());
-}
-}
-return props;
-}
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/1fa09dc5/phoenix-core/src/main/java/org/apache/phoenix/util/PropertiesUtil.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/util/PropertiesUtil.java 
b/phoenix-core/src/main/java/org/apache/phoenix/util/PropertiesUtil.java
index d894e58..bcb9aa4 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/PropertiesUtil.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/PropertiesUtil.java
@@ -17,7 +17,10 @@
  */
 package org.apache.phoenix.util;
 
+import java.util.Iterator;
+import java.util.Map;
 import java.util.Properties;
+import org.apache.hadoop.conf.Configuration;
 
 public class PropertiesUtil {
 
@@ -36,4 +39,23 @@ public class PropertiesUtil {
 }
 return newProperties;
 }
+
+ /**
+ * Add properties from the given Configuration to the provided Properties.
+ *
+ * @param props properties to which connection information from the 
Configuration will be added
+ * @param conf configuration containing connection information
+ * @return the input Properties value, with additional connection 
information from the
+ * given Configuration
+ */
+public static Properties extractPr

[05/50] [abbrv] phoenix git commit: PHOENIX-1856 Include min row key for each region in stats row-addendum_1(Ram)

2015-06-15 Thread maryannxue
PHOENIX-1856 Include min row key for each region in stats row-addendum_1(Ram)


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

Branch: refs/heads/calcite
Commit: 70de0cd485705ecc1f8b7864fe3657c4e8408d36
Parents: efd7c9f
Author: Rajeshbabu Chintaguntla 
Authored: Thu Apr 30 16:25:33 2015 +0530
Committer: Rajeshbabu Chintaguntla 
Committed: Thu Apr 30 16:25:33 2015 +0530

--
 .../java/org/apache/phoenix/schema/stats/StatisticsCollector.java  | 2 ++
 1 file changed, 2 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/70de0cd4/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsCollector.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsCollector.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsCollector.java
index 8e41d4e..272cac6 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsCollector.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsCollector.java
@@ -284,6 +284,8 @@ public class StatisticsCollector {
 public void getMinKey(ImmutableBytesWritable ptr) {
 if (minKey != null) {
 ptr.set(minKey, minKeyOffset, minKeyLength);
+} else {
+ptr.set(HConstants.EMPTY_BYTE_ARRAY);
 }
 }
 }



[50/50] [abbrv] phoenix git commit: Fix merge errors

2015-06-15 Thread maryannxue
Fix merge errors


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

Branch: refs/heads/calcite
Commit: 62d6720f7f2f1bef8a2c99ca2a6aa3feb29a51df
Parents: f9ddb98 d1934af
Author: maryannxue 
Authored: Mon Jun 15 14:45:03 2015 -0400
Committer: maryannxue 
Committed: Mon Jun 15 14:45:03 2015 -0400

--
 .gitignore  |1 +
 NOTICE  |   10 +
 bin/daemon.py   |  989 
 bin/end2endTest.py  |5 +-
 bin/log4j.properties|9 +-
 bin/phoenix_utils.py|  139 +-
 bin/psql.py |8 +-
 bin/queryserver.py  |  203 +
 bin/sqlline-thin.py |   89 +
 bin/sqlline.py  |6 +-
 dev/jenkinsEnv.sh   |   31 +
 dev/make_rc.sh  |5 +
 dev/smart-apply-patch.sh|   96 +
 dev/test-patch.properties   |   35 +
 dev/test-patch.sh   | 1081 +
 phoenix-assembly/pom.xml|   52 +-
 phoenix-assembly/src/build/client.xml   |   37 +-
 .../src/build/components-minimal.xml|2 +
 .../components/all-common-dependencies.xml  |1 +
 .../src/build/components/all-common-files.xml   |6 +-
 .../src/build/components/all-common-jars.xml|   30 +-
 phoenix-assembly/src/build/src.xml  |4 +-
 phoenix-core/pom.xml|   23 +-
 ...ReplayWithIndexWritesAndCompressedWALIT.java |4 +-
 .../org/apache/phoenix/end2end/ArrayIT.java |  125 +-
 .../phoenix/end2end/ArrayPrependFunctionIT.java |  652 +++
 .../phoenix/end2end/ArraysWithNullsIT.java  |  300 ++
 .../phoenix/end2end/DecodeFunctionIT.java   |9 +-
 .../phoenix/end2end/EncodeFunctionIT.java   |8 +-
 .../phoenix/end2end/EvaluationOfORIT.java   |   11 +
 .../org/apache/phoenix/end2end/HashJoinIT.java  |   54 +
 .../apache/phoenix/end2end/InstrFunctionIT.java |   12 +-
 .../phoenix/end2end/MappingTableDataTypeIT.java |   67 +-
 .../phoenix/end2end/PhoenixMetricsIT.java   |4 -
 .../end2end/QueryDatabaseMetaDataIT.java|5 +
 .../org/apache/phoenix/end2end/QueryMoreIT.java |6 +-
 .../end2end/SkipScanAfterManualSplitIT.java |2 +-
 .../apache/phoenix/end2end/SortMergeJoinIT.java |   54 +
 .../phoenix/end2end/SqrtFunctionEnd2EndIT.java  |  143 +
 .../StatsCollectorWithSplitsAndMultiCFIT.java   |   32 +-
 .../org/apache/phoenix/end2end/SubqueryIT.java  |   18 +
 .../end2end/TenantSpecificTablesDDLIT.java  |5 +
 .../phoenix/end2end/ToDateFunctionIT.java   |   46 +-
 .../phoenix/end2end/UserDefinedFunctionsIT.java |  656 +++
 .../end2end/index/DropIndexDuringUpsertIT.java  |2 +-
 .../apache/phoenix/execute/PartialCommitIT.java |  317 ++
 .../EndToEndCoveredColumnsIndexBuilderIT.java   |4 +-
 .../iterate/RoundRobinResultIteratorIT.java |  319 ++
 .../apache/phoenix/mapreduce/IndexToolIT.java   |3 +-
 phoenix-core/src/main/antlr3/PhoenixSQL.g   |   76 +-
 .../regionserver/IndexHalfStoreFileReader.java  |   31 +-
 .../IndexHalfStoreFileReaderGenerator.java  |9 +-
 .../regionserver/IndexSplitTransaction.java |  104 +-
 .../hbase/regionserver/LocalIndexMerger.java|   19 +-
 .../hbase/regionserver/LocalIndexSplitter.java  |   11 +-
 .../org/apache/phoenix/cache/GlobalCache.java   |   30 +-
 .../apache/phoenix/cache/ServerCacheClient.java |   10 +-
 .../cache/aggcache/SpillableGroupByCache.java   |   13 +-
 .../apache/phoenix/compile/ColumnResolver.java  |   17 +
 .../phoenix/compile/CreateFunctionCompiler.java |   80 +
 .../phoenix/compile/CreateIndexCompiler.java|2 +-
 .../apache/phoenix/compile/DeleteCompiler.java  |   15 +-
 .../phoenix/compile/ExpressionCompiler.java |   33 +-
 .../apache/phoenix/compile/FromCompiler.java|  199 +-
 .../apache/phoenix/compile/JoinCompiler.java|9 +-
 .../apache/phoenix/compile/PostDDLCompiler.java |   14 +
 .../phoenix/compile/ProjectionCompiler.java |2 +-
 .../apache/phoenix/compile/QueryCompiler.java   |   18 +-
 .../org/apache/phoenix/compile/QueryPlan.java   |   11 +
 .../apache/phoenix/compile/RowProjector.java|   32 +-
 .../phoenix/compile/StatementNormalizer.java|5 +-
 .../phoenix/compile/SubqueryRewriter.java   |6 +-
 .../phoenix/compile/SubselectRewriter.java  |2 +-
 .../apache/phoenix/compile/TraceQueryPlan.java  |5 +
 .../compile/TupleProjectionCompiler.java|4

[22/50] [abbrv] phoenix git commit: PHOENIX-1995 client uberjar doesn't support dfs

2015-06-15 Thread maryannxue
PHOENIX-1995 client uberjar doesn't support dfs


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

Branch: refs/heads/calcite
Commit: 981ed472cb597440fe7c3a2aaa088b103f8f7352
Parents: a4b4e0e
Author: Nick Dimiduk 
Authored: Wed May 20 12:29:36 2015 -0700
Committer: Nick Dimiduk 
Committed: Wed May 20 12:55:23 2015 -0700

--
 phoenix-assembly/src/build/client.xml | 10 ++
 1 file changed, 10 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/981ed472/phoenix-assembly/src/build/client.xml
--
diff --git a/phoenix-assembly/src/build/client.xml 
b/phoenix-assembly/src/build/client.xml
index 101ccd6..4bd4544 100644
--- a/phoenix-assembly/src/build/client.xml
+++ b/phoenix-assembly/src/build/client.xml
@@ -29,6 +29,16 @@
 jar
   
   false
+
+  
+
+  
+  metaInf-services
+
+  
   
   
 src/build/components-minimal.xml



[36/50] [abbrv] phoenix git commit: PHOENIX-2022 Make BaseRegionScanner.next abstract

2015-06-15 Thread maryannxue
PHOENIX-2022 Make BaseRegionScanner.next abstract

Avoid infinite recursion by removing a recursive call within
BaseRegionScanner.next, which was already being used as an
abstract method.


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

Branch: refs/heads/calcite
Commit: 583b5b1e115a81799cc3e6d0a20a0fe665f666e3
Parents: b7f1382
Author: Gabriel Reid 
Authored: Mon Jun 1 08:57:22 2015 +0200
Committer: Gabriel Reid 
Committed: Mon Jun 1 08:57:22 2015 +0200

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


http://git-wip-us.apache.org/repos/asf/phoenix/blob/583b5b1e/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/BaseRegionScanner.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/BaseRegionScanner.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/BaseRegionScanner.java
index 828f776..3f73048 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/BaseRegionScanner.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/BaseRegionScanner.java
@@ -33,9 +33,7 @@ public abstract class BaseRegionScanner implements 
RegionScanner {
 }
 
 @Override
-public boolean next(List results) throws IOException {
-return next(results);
-}
+public abstract boolean next(List results) throws IOException;
 
 @Override
 public boolean next(List result, ScannerContext scannerContext) 
throws IOException {



[41/50] [abbrv] phoenix git commit: PHOENIX-777 - Support null value for fixed length ARRAY - Addendum (Ram)

2015-06-15 Thread maryannxue
PHOENIX-777 - Support null value for fixed length ARRAY - Addendum (Ram)


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

Branch: refs/heads/calcite
Commit: 6c3d50ac198dd9159fb50cfe898734db99257c10
Parents: 7f6bf10
Author: ramkrishna 
Authored: Tue Jun 2 14:32:02 2015 +0530
Committer: ramkrishna 
Committed: Tue Jun 2 14:32:02 2015 +0530

--
 .../main/java/org/apache/phoenix/schema/types/PTimestamp.java   | 5 +
 1 file changed, 5 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/6c3d50ac/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PTimestamp.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PTimestamp.java 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PTimestamp.java
index d396adc..16b110e 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PTimestamp.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PTimestamp.java
@@ -26,6 +26,7 @@ import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.phoenix.query.QueryConstants;
 import org.apache.phoenix.schema.SortOrder;
+import org.apache.phoenix.util.ByteUtil;
 import org.apache.phoenix.util.DateUtil;
 
 public class PTimestamp extends PDataType {
@@ -47,6 +48,10 @@ public class PTimestamp extends PDataType {
   @Override
   public int toBytes(Object object, byte[] bytes, int offset) {
 if (object == null) {
+  // Create the byte[] of size MAX_TIMESTAMP_BYTES
+  if(bytes.length != getByteSize()) {
+  bytes = Bytes.padTail(bytes, (getByteSize() - bytes.length));
+  }
   PDate.INSTANCE.getCodec().encodeLong(0l, bytes, offset);
   Bytes.putInt(bytes, offset + Bytes.SIZEOF_LONG, 0);
   return getByteSize();



[31/50] [abbrv] phoenix git commit: PHOENIX-2005 Connection utilities omit zk client port, parent znode (addendum)

2015-06-15 Thread maryannxue
PHOENIX-2005 Connection utilities omit zk client port, parent znode (addendum)


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

Branch: refs/heads/calcite
Commit: e493215bff7057bad1a52efecca90384a1dd9412
Parents: afb0120
Author: Nick Dimiduk 
Authored: Tue May 26 17:41:04 2015 -0700
Committer: Nick Dimiduk 
Committed: Tue May 26 17:41:04 2015 -0700

--
 .../phoenix/jdbc/PhoenixEmbeddedDriver.java |  2 +-
 .../java/org/apache/phoenix/util/QueryUtil.java |  2 +-
 .../phoenix/jdbc/PhoenixEmbeddedDriverTest.java | 20 
 3 files changed, 22 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/e493215b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriver.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriver.java 
b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriver.java
index 2451603..3cfaacc 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriver.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriver.java
@@ -209,7 +209,7 @@ public abstract class PhoenixEmbeddedDriver implements 
Driver, org.apache.phoeni
 url = url == null ? "" : url;
 url = url.startsWith(PhoenixRuntime.JDBC_PROTOCOL)
 ? url.substring(PhoenixRuntime.JDBC_PROTOCOL.length())
-: url;
+: PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + url;
 StringTokenizer tokenizer = new StringTokenizer(url, DELIMITERS, 
true);
 int nTokens = 0;
 String[] tokens = new String[5];

http://git-wip-us.apache.org/repos/asf/phoenix/blob/e493215b/phoenix-core/src/main/java/org/apache/phoenix/util/QueryUtil.java
--
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/QueryUtil.java 
b/phoenix-core/src/main/java/org/apache/phoenix/util/QueryUtil.java
index bd38983..a2d4a91 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/QueryUtil.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/QueryUtil.java
@@ -290,7 +290,7 @@ public final class QueryUtil {
 throws ClassNotFoundException,
 SQLException {
 String url = getConnectionUrl(props, conf);
-LOG.info("Creating connection with the jdbc url:" + url);
+LOG.info("Creating connection with the jdbc url: " + url);
 PropertiesUtil.extractProperties(props, conf);
 return DriverManager.getConnection(url, props);
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/e493215b/phoenix-core/src/test/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriverTest.java
--
diff --git 
a/phoenix-core/src/test/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriverTest.java
 
b/phoenix-core/src/test/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriverTest.java
index 083b205..4eda825 100644
--- 
a/phoenix-core/src/test/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriverTest.java
+++ 
b/phoenix-core/src/test/java/org/apache/phoenix/jdbc/PhoenixEmbeddedDriverTest.java
@@ -34,23 +34,33 @@ public class PhoenixEmbeddedDriverTest {
 @Test
 public void testGetConnectionInfo() throws SQLException {
 String[] urls = new String[] {
+null,
+"",
 "jdbc:phoenix",
 "jdbc:phoenix;test=true",
 "jdbc:phoenix:localhost",
+"localhost",
+"localhost;",
 "jdbc:phoenix:localhost:123",
 "jdbc:phoenix:localhost:123;foo=bar",
+"localhost:123",
 "jdbc:phoenix:localhost:123:/hbase",
 "jdbc:phoenix:localhost:123:/foo-bar",
 "jdbc:phoenix:localhost:123:/foo-bar;foo=bas",
+"localhost:123:/foo-bar",
 "jdbc:phoenix:localhost:/hbase",
 "jdbc:phoenix:localhost:/foo-bar",
 "jdbc:phoenix:localhost:/foo-bar;test=true",
+"localhost:/foo-bar",
 "jdbc:phoenix:v1,v2,v3",
 "jdbc:phoenix:v1,v2,v3;",
 "jdbc:phoenix:v1,v2,v3;test=true",
+"v1,v2,v3",
 "jdbc:phoenix:v1,v2,v3:/hbase",
 "jdbc:phoenix:v1,v2,v3:/hbase;test=true",
+"v1,v2,v3:/foo-bar",
 "jdbc:phoenix:v1,v2,v3:123:/hbase",
+"v1,v2,v3:123:/hbase",
 "jdbc:phoenix:v1,v2,v3:123:/hbase;test=false",
 
"jdbc:phoenix:v1,v2,v3:123:/hbase

[20/50] [abbrv] phoenix git commit: PHOENIX-1990 bin/queryserver makeWinServiceDesc doesn't actually work in Windows

2015-06-15 Thread maryannxue
PHOENIX-1990 bin/queryserver makeWinServiceDesc doesn't actually work in Windows


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

Branch: refs/heads/calcite
Commit: c83ab9edba7b417a001fb702de5d893cbda95f29
Parents: 6fc53b5
Author: Nick Dimiduk 
Authored: Mon May 18 16:00:31 2015 -0700
Committer: Nick Dimiduk 
Committed: Mon May 18 16:00:31 2015 -0700

--
 bin/queryserver.py | 17 ++---
 1 file changed, 14 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/c83ab9ed/bin/queryserver.py
--
diff --git a/bin/queryserver.py b/bin/queryserver.py
index 6a18741..7666246 100755
--- a/bin/queryserver.py
+++ b/bin/queryserver.py
@@ -78,11 +78,22 @@ phoenix_out_file = '%s.out' % phoenix_file_basename
 phoenix_pid_file = '%s.pid' % phoenix_file_basename
 opts = os.getenv('PHOENIX_QUERYSERVER_OPTS', '')
 
-# load hbase-env.sh to extract JAVA_HOME, HBASE_PID_DIR, HBASE_LOG_DIR
-hbase_env_path = os.path.join(hbase_config_path, 'hbase-env.sh')
+# load hbase-env.??? to extract JAVA_HOME, HBASE_PID_DIR, HBASE_LOG_DIR
+hbase_env_path = None
+hbase_env_cmd  = None
+if os.name == 'posix':
+hbase_env_path = os.path.join(hbase_config_path, 'hbase-env.sh')
+hbase_env_cmd = ['bash', '-c', 'source %s && env' % hbase_env_path]
+elif os.name == 'nt':
+hbase_env_path = os.path.join(hbase_config_path, 'hbase-env.cmd')
+hbase_env_cmd = ['cmd.exe', '/c', 'call %s & set' % hbase_env_path]
+if not hbase_env_path or not hbase_env_cmd:
+print >> sys.stderr, "hbase-env file unknown on platform %s" % os.name
+sys.exit(-1)
+
 hbase_env = {}
 if os.path.isfile(hbase_env_path):
-p = subprocess.Popen(['bash', '-c', 'source %s && env' % hbase_env_path], 
stdout = subprocess.PIPE)
+p = subprocess.Popen(hbase_env_cmd, stdout = subprocess.PIPE)
 for x in p.stdout:
 (k, _, v) = x.partition('=')
 hbase_env[k.strip()] = v.strip()



[38/50] [abbrv] phoenix git commit: PHOENIX-2016 Some Phoenix tests failed with NPE(Alicia Ying Shu)

2015-06-15 Thread maryannxue
PHOENIX-2016 Some Phoenix tests failed with NPE(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/dc3083fe
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/dc3083fe
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/dc3083fe

Branch: refs/heads/calcite
Commit: dc3083fec11720a3b92f3edf98a679406004550f
Parents: 82df3b9
Author: Rajeshbabu Chintaguntla 
Authored: Mon Jun 1 21:33:47 2015 +0530
Committer: Rajeshbabu Chintaguntla 
Committed: Mon Jun 1 21:33:47 2015 +0530

--
 phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java | 1 +
 1 file changed, 1 insertion(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/dc3083fe/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
--
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java 
b/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
index b0574c3..fa78656 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
@@ -1627,6 +1627,7 @@ public abstract class BaseTest {
  * Disable and drop all the tables except SYSTEM.CATALOG and 
SYSTEM.SEQUENCE
  */
 private static void disableAndDropNonSystemTables() throws Exception {
+if (driver == null) return;
 HBaseAdmin admin = driver.getConnectionQueryServices(null, 
null).getAdmin();
 try {
 HTableDescriptor[] tables = admin.listTables();



[15/50] [abbrv] phoenix git commit: PHOENIX-1945 Phoenix tarball from assembly does not contain phoenix-[version]-server.jar

2015-06-15 Thread maryannxue
PHOENIX-1945 Phoenix tarball from assembly does not contain 
phoenix-[version]-server.jar


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

Branch: refs/heads/calcite
Commit: c1e5c71abb84f0b2dcb3e1384e21a3f5a70a4d1a
Parents: b5ef25c
Author: Enis Soztutar 
Authored: Wed May 13 11:11:17 2015 -0700
Committer: Enis Soztutar 
Committed: Wed May 13 11:11:17 2015 -0700

--
 phoenix-assembly/pom.xml | 40 
 1 file changed, 20 insertions(+), 20 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/c1e5c71a/phoenix-assembly/pom.xml
--
diff --git a/phoenix-assembly/pom.xml b/phoenix-assembly/pom.xml
index 5a73e7a..51ff74d 100644
--- a/phoenix-assembly/pom.xml
+++ b/phoenix-assembly/pom.xml
@@ -65,7 +65,7 @@
 
   
   
-package-to-tar
+client-minimal
 package
 
   single
@@ -73,51 +73,51 @@
 
 phoenix-${project.version}
   false
-  gnu
-  false
+  true
   
-src/build/package-to-tar-all.xml
+   
+src/build/client-without-hbase.xml
+   
+src/build/client-minimal.xml
+   
+src/build/server.xml
+   
+src/build/server-without-antlr.xml
   
-  posix
 
   
   
-package-to-source-tar
+package-to-tar
 package
 
   single
 
 
-phoenix-${project.version}-source
+phoenix-${project.version}
   false
   gnu
   false
   
-src/build/src.xml
+src/build/package-to-tar-all.xml
   
   posix
 
-
+  
   
-client-minimal
+package-to-source-tar
 package
 
   single
 
 
-phoenix-${project.version}
+phoenix-${project.version}-source
   false
-  true
+  gnu
+  false
   
-   
-src/build/client-without-hbase.xml
-   
-src/build/client-minimal.xml
-   
-src/build/server.xml
-   
-src/build/server-without-antlr.xml
+src/build/src.xml
   
+  posix
 
   
 



[18/50] [abbrv] phoenix git commit: PHOENIX-1976 Exit gracefully if addShutdownHook fails.

2015-06-15 Thread maryannxue
PHOENIX-1976 Exit gracefully if addShutdownHook fails.

If the JVM is already in the process of shutting down,
we don't need to add the shutdown hook for the PhoenixDriver
instance. Additionally, we shouldn't advertise this instance
either since we're going down.


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

Branch: refs/heads/calcite
Commit: 23f5acf86e1065f6bc8c342df4ba29f18aafea8a
Parents: 289a875
Author: Josh Elser 
Authored: Thu May 14 17:40:46 2015 -0400
Committer: Nick Dimiduk 
Committed: Fri May 15 11:05:05 2015 -0700

--
 .../org/apache/phoenix/jdbc/PhoenixDriver.java  | 46 ++--
 1 file changed, 32 insertions(+), 14 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/23f5acf8/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 6360d06..cfabe82 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
@@ -60,25 +60,43 @@ public final class PhoenixDriver extends 
PhoenixEmbeddedDriver {
 private static volatile String driverShutdownMsg;
 static {
 try {
-DriverManager.registerDriver( INSTANCE = new PhoenixDriver() );
-// Add shutdown hook to release any resources that were never 
closed
-// In theory not necessary, but it won't hurt anything
-Runtime.getRuntime().addShutdownHook(new Thread() {
-@Override
-public void run() {
-try {
-INSTANCE.close();
-} catch (SQLException e) {
-logger.warn("Unable to close PhoenixDriver on 
shutdown", e);
-} finally {
-driverShutdownMsg = "Phoenix driver closed because 
server is shutting down";
+INSTANCE = new PhoenixDriver();
+try {
+// Add shutdown hook to release any resources that were never 
closed
+// In theory not necessary, but it won't hurt anything
+Runtime.getRuntime().addShutdownHook(new Thread() {
+@Override
+public void run() {
+closeInstance(INSTANCE);
 }
-}
-});
+});
+
+// Only register the driver when we successfully register the 
shutdown hook
+// Don't want to register it if we're already in the process 
of going down.
+DriverManager.registerDriver( INSTANCE );
+} catch (IllegalStateException e) {
+logger.warn("Failed to register PhoenixDriver shutdown hook as 
the JVM is already shutting down");
+
+// Close the instance now because we don't have the shutdown 
hook
+closeInstance(INSTANCE);
+
+throw e;
+}
 } catch (SQLException e) {
 throw new IllegalStateException("Unable to register " + 
PhoenixDriver.class.getName() + ": "+ e.getMessage());
 }
 }
+
+private static void closeInstance(PhoenixDriver instance) {
+try {
+instance.close();
+} catch (SQLException e) {
+logger.warn("Unable to close PhoenixDriver on shutdown", e);
+} finally {
+driverShutdownMsg = "Phoenix driver closed because server is 
shutting down";
+}
+}
+
 // One entry per cluster here
 private final ConcurrentMap 
connectionQueryServicesMap = new 
ConcurrentHashMap(3);
 



[43/50] [abbrv] phoenix git commit: PHOENIX-2018 Implement math build-in function SQRT (Shuxiong Ye)

2015-06-15 Thread maryannxue
PHOENIX-2018 Implement math build-in function SQRT (Shuxiong Ye)


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

Branch: refs/heads/calcite
Commit: e54c99d8b1ce7bd6118df46209e102e9a86c3782
Parents: 47466e3
Author: James Taylor 
Authored: Thu Jun 4 14:26:27 2015 -0700
Committer: James Taylor 
Committed: Thu Jun 4 14:26:27 2015 -0700

--
 .../phoenix/end2end/SqrtFunctionEnd2EndIT.java  | 143 ++
 .../phoenix/expression/ExpressionType.java  |   4 +-
 .../function/JavaMathOneArgumentFunction.java   |  77 ++
 .../expression/function/SqrtFunction.java   |  49 ++
 .../phoenix/expression/SqrtFunctionTest.java| 150 +++
 5 files changed, 422 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/e54c99d8/phoenix-core/src/it/java/org/apache/phoenix/end2end/SqrtFunctionEnd2EndIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SqrtFunctionEnd2EndIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SqrtFunctionEnd2EndIT.java
new file mode 100644
index 000..50fdd4f
--- /dev/null
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SqrtFunctionEnd2EndIT.java
@@ -0,0 +1,143 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.phoenix.end2end;
+
+import static org.apache.phoenix.util.TestUtil.closeStmtAndConn;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+
+import org.apache.phoenix.expression.function.SqrtFunction;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * End to end tests for {@link SqrtFunction}
+ */
+public class SqrtFunctionEnd2EndIT extends BaseHBaseManagedTimeIT {
+
+private static final String KEY = "key";
+private static final double ZERO = 1e-8;
+
+@Before
+public void initTable() throws Exception {
+Connection conn = null;
+PreparedStatement stmt = null;
+try {
+conn = DriverManager.getConnection(getUrl());
+String ddl;
+ddl = "CREATE TABLE testSigned (k VARCHAR NOT NULL PRIMARY KEY, 
doub DOUBLE, fl FLOAT, inte INTEGER, lon BIGINT, smalli SMALLINT, tinyi 
TINYINT)";
+conn.createStatement().execute(ddl);
+ddl = "CREATE TABLE testUnsigned (k VARCHAR NOT NULL PRIMARY KEY, 
doub UNSIGNED_DOUBLE, fl UNSIGNED_FLOAT, inte UNSIGNED_INT, lon UNSIGNED_LONG, 
smalli UNSIGNED_SMALLINT, tinyi UNSIGNED_TINYINT)";
+conn.createStatement().execute(ddl);
+conn.commit();
+} finally {
+closeStmtAndConn(stmt, conn);
+}
+}
+
+private void updateSignedTable(Connection conn, double data) throws 
Exception {
+PreparedStatement stmt = conn.prepareStatement("UPSERT INTO testSigned 
VALUES (?, ?, ?, ?, ?, ?, ?)");
+stmt.setString(1, KEY);
+Double d = Double.valueOf(data);
+stmt.setDouble(2, d.doubleValue());
+stmt.setFloat(3, d.floatValue());
+stmt.setInt(4, d.intValue());
+stmt.setLong(5, d.longValue());
+stmt.setShort(6, d.shortValue());
+stmt.setByte(7, d.byteValue());
+stmt.executeUpdate();
+conn.commit();
+}
+
+private void updateUnsignedTable(Connection conn, double data) throws 
Exception {
+PreparedStatement stmt = conn.prepareStatement("UPSERT INTO 
testUnsigned VALUES (?, ?, ?, ?, ?, ?, ?)");
+stmt.setString(1, KEY);
+Double d = Double.valueOf(data);
+stmt.setDouble(2, d.doubleValue());
+stmt.setFloat(3, d.floatValue());
+stmt.setInt(4, d.intValue());
+stmt.setLong(5, d.longValue());
+stmt.setShort(6, d.shor

[24/50] [abbrv] phoenix git commit: PHOENIX-1984 Make INSTR 1-based instead of 0-based

2015-06-15 Thread maryannxue
PHOENIX-1984 Make INSTR 1-based instead of 0-based

Bring functionality of INSTR built-in function in-line with other
SQL string functions, with indexing of strings starting at 1.

Signed-off-by: Gabriel Reid 


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

Branch: refs/heads/calcite
Commit: c2fed1dac8305f489939fc18e47cd2c2a6c596d8
Parents: d3ff079
Author: NAVEEN MADHIRE 
Authored: Mon May 18 22:14:57 2015 -0500
Committer: Gabriel Reid 
Committed: Thu May 21 17:24:47 2015 +0200

--
 .../apache/phoenix/end2end/InstrFunctionIT.java | 12 ++---
 .../expression/function/InstrFunction.java  |  2 +-
 .../expression/function/InstrFunctionTest.java  | 48 ++--
 3 files changed, 31 insertions(+), 31 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/c2fed1da/phoenix-core/src/it/java/org/apache/phoenix/end2end/InstrFunctionIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/InstrFunctionIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/InstrFunctionIT.java
index 57c0661..b869ff4 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/InstrFunctionIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/InstrFunctionIT.java
@@ -63,7 +63,7 @@ public class InstrFunctionIT extends BaseHBaseManagedTimeIT {
 Connection conn = DriverManager.getConnection(getUrl());
 initTable(conn, "ASC", "abcdefghijkl","fgh");
 String queryToExecute = "SELECT INSTR(name, 'fgh') FROM SAMPLE";
-testInstr(conn, queryToExecute, 5);
+testInstr(conn, queryToExecute, 6);
 }
 
 @Test
@@ -71,7 +71,7 @@ public class InstrFunctionIT extends BaseHBaseManagedTimeIT {
 Connection conn = DriverManager.getConnection(getUrl());
 initTable(conn, "DESC", "abcdefghijkl","fgh");
 String queryToExecute = "SELECT INSTR(name, 'fgh') FROM SAMPLE";
-testInstr(conn, queryToExecute, 5);
+testInstr(conn, queryToExecute, 6);
 }
 
 @Test
@@ -79,7 +79,7 @@ public class InstrFunctionIT extends BaseHBaseManagedTimeIT {
 Connection conn = DriverManager.getConnection(getUrl());
 initTable(conn, "ASC", "abcde fghijkl","lmn");
 String queryToExecute = "SELECT INSTR(name, 'lmn') FROM SAMPLE";
-testInstr(conn, queryToExecute, -1);
+testInstr(conn, queryToExecute, 0);
 }
 
 @Test
@@ -87,7 +87,7 @@ public class InstrFunctionIT extends BaseHBaseManagedTimeIT {
 Connection conn = DriverManager.getConnection(getUrl());
 initTable(conn, "DESC", "abcde fghijkl","lmn");
 String queryToExecute = "SELECT INSTR(name, 'lmn') FROM SAMPLE";
-testInstr(conn, queryToExecute, -1);
+testInstr(conn, queryToExecute, 0);
 }
 
 @Test
@@ -95,7 +95,7 @@ public class InstrFunctionIT extends BaseHBaseManagedTimeIT {
 Connection conn = DriverManager.getConnection(getUrl());
 initTable(conn, "ASC", "AɚɦFGH","ɚɦ");
 String queryToExecute = "SELECT INSTR(name, 'ɚɦ') FROM SAMPLE";
-testInstr(conn, queryToExecute, 1);
+testInstr(conn, queryToExecute, 2);
 }
 
 @Test
@@ -103,7 +103,7 @@ public class InstrFunctionIT extends BaseHBaseManagedTimeIT 
{
 Connection conn = DriverManager.getConnection(getUrl());
 initTable(conn, "DESC", "AɚɦFGH","ɚɦ");
 String queryToExecute = "SELECT INSTR(name, 'ɚɦ') FROM SAMPLE";
-testInstr(conn, queryToExecute, 1);
+testInstr(conn, queryToExecute, 2);
 } 
 
 @Test

http://git-wip-us.apache.org/repos/asf/phoenix/blob/c2fed1da/phoenix-core/src/main/java/org/apache/phoenix/expression/function/InstrFunction.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/InstrFunction.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/InstrFunction.java
index 317d4b3..7a002f8 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/InstrFunction.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/InstrFunction.java
@@ -82,7 +82,7 @@ public class InstrFunction extends ScalarFunction{
 
 String sourceStr = (String) PVarchar.INSTANCE.toObject(ptr, 
getChildren().get(0).getSortOrder());
 
-position = sourceStr.indexOf(strToSearch);
+position = sourceStr.indexOf(strToSearch) + 1;
 ptr.set(PInteger.INSTANCE.toBytes(position));
 return true;
 }

http://git-wip-

[06/50] [abbrv] phoenix git commit: PHOENIX-1908 TenantSpecificTablesDDLIT#testAddDropColumn is flaky(Rajeshbabu)

2015-06-15 Thread maryannxue
PHOENIX-1908 TenantSpecificTablesDDLIT#testAddDropColumn is flaky(Rajeshbabu)


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

Branch: refs/heads/calcite
Commit: d223f2c3997bcd8f85c8dcae3703ceb39036662d
Parents: 70de0cd
Author: Rajeshbabu Chintaguntla 
Authored: Thu Apr 30 19:05:57 2015 +0530
Committer: Rajeshbabu Chintaguntla 
Committed: Thu Apr 30 19:05:57 2015 +0530

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


http://git-wip-us.apache.org/repos/asf/phoenix/blob/d223f2c3/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 3ee527a..e613007 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
@@ -1795,7 +1795,7 @@ public class MetaDataEndpointImpl extends 
MetaDataProtocol implements Coprocesso
 // column, get lock and drop the index. If 
found as covered
 // column, delete from index (do this 
client side?).
 // In either case, invalidate index if the 
column is in it
-PhoenixConnection connection = 
QueryUtil.getConnection(env.getConfiguration()).unwrap(PhoenixConnection.class);
+PhoenixConnection connection = 
table.getIndexes().isEmpty() ? null : 
QueryUtil.getConnection(env.getConfiguration()).unwrap(PhoenixConnection.class);
 for (PTable index : table.getIndexes()) {
 try {
 IndexMaintainer indexMaintainer = 
index.getIndexMaintainer(table, connection);



[19/50] [abbrv] phoenix git commit: PHOENIX-1980 CsvBulkLoad cannot load hbase-site.xml from classpath

2015-06-15 Thread maryannxue
PHOENIX-1980 CsvBulkLoad cannot load hbase-site.xml from classpath


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

Branch: refs/heads/calcite
Commit: 6fc53b5792ea7bdd1b486860606966e76f2e5e3f
Parents: 23f5acf
Author: Nick Dimiduk 
Authored: Mon May 18 10:33:42 2015 -0700
Committer: Nick Dimiduk 
Committed: Mon May 18 10:33:42 2015 -0700

--
 .../main/java/org/apache/phoenix/mapreduce/CsvBulkLoadTool.java| 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/6fc53b57/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 31f8b42..a5a8aa1 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
@@ -176,7 +176,7 @@ public class CsvBulkLoadTool extends Configured implements 
Tool {
 @Override
 public int run(String[] args) throws Exception {
 
-Configuration conf = HBaseConfiguration.addHbaseResources(getConf());
+Configuration conf = HBaseConfiguration.create(getConf());
 
 CommandLine cmdLine = null;
 try {



[49/50] [abbrv] phoenix git commit: PHOENIX-2032 psql.py is broken after PHOENIX-2013

2015-06-15 Thread maryannxue
PHOENIX-2032 psql.py is broken after PHOENIX-2013


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

Branch: refs/heads/calcite
Commit: d1934afbe6230e823b9009950fe721165e98cc7c
Parents: bfb0eee
Author: Nick Dimiduk 
Authored: Fri Jun 12 10:23:05 2015 -0700
Committer: Nick Dimiduk 
Committed: Fri Jun 12 12:12:09 2015 -0700

--
 phoenix-assembly/pom.xml  |  4 
 phoenix-assembly/src/build/client.xml | 27 +++
 2 files changed, 23 insertions(+), 8 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/d1934afb/phoenix-assembly/pom.xml
--
diff --git a/phoenix-assembly/pom.xml b/phoenix-assembly/pom.xml
index 51ff74d..baf6738 100644
--- a/phoenix-assembly/pom.xml
+++ b/phoenix-assembly/pom.xml
@@ -152,10 +152,6 @@
 
 
   org.apache.phoenix
-  phoenix-spark
-
-
-  org.apache.phoenix
   phoenix-server
 
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d1934afb/phoenix-assembly/src/build/client.xml
--
diff --git a/phoenix-assembly/src/build/client.xml 
b/phoenix-assembly/src/build/client.xml
index 4bd4544..0e1e1f6 100644
--- a/phoenix-assembly/src/build/client.xml
+++ b/phoenix-assembly/src/build/client.xml
@@ -63,13 +63,32 @@
 
 
 
+  phoenix-flume, phoenix-pig, etc). We should exclude phoenix-server and
+  phoenix-server-client in the future, see PHOENIX-2032, PHOENIX-2038 -->
 
   /
   true
-  
-org.apache.phoenix:phoenix-*
-  
+  
+  
+
+  *license*
+  *LICENSE*
+  **/license/**
+  **/LICENSE/**
+
+  
+  
+  true
+  
+  
 
   
 



[09/50] [abbrv] phoenix git commit: PHOENIX-1948 bin scripts run under make_rc.sh packaging

2015-06-15 Thread maryannxue
PHOENIX-1948 bin scripts run under make_rc.sh packaging


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

Branch: refs/heads/calcite
Commit: 45a919f380a2743bdcf3838da2cd9873c3f518c0
Parents: b47dcb6
Author: Nick Dimiduk 
Authored: Wed May 6 09:58:35 2015 -0700
Committer: Nick Dimiduk 
Committed: Wed May 6 09:58:35 2015 -0700

--
 bin/phoenix_utils.py | 142 +++---
 1 file changed, 84 insertions(+), 58 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/45a919f3/bin/phoenix_utils.py
--
diff --git a/bin/phoenix_utils.py b/bin/phoenix_utils.py
index 2cf7db7..383e0e1 100755
--- a/bin/phoenix_utils.py
+++ b/bin/phoenix_utils.py
@@ -41,7 +41,8 @@ def find(pattern, classPaths):
 return ""
 
 def findFileInPathWithoutRecursion(pattern, path):
-
+if not os.path.exists(path):
+return ""
 files = [f for f in os.listdir(path) if 
os.path.isfile(os.path.join(path,f))]
 # sort the file names so *-client always precedes *-thin-client
 files.sort()
@@ -52,63 +53,71 @@ def findFileInPathWithoutRecursion(pattern, path):
 return ""
 
 def setPath():
- PHOENIX_CLIENT_JAR_PATTERN = "phoenix-*-client.jar"
- PHOENIX_THIN_CLIENT_JAR_PATTERN = "phoenix-*-thin-client.jar"
- PHOENIX_QUERYSERVER_JAR_PATTERN = "phoenix-server-*-runnable.jar"
- PHOENIX_TESTS_JAR_PATTERN = "phoenix-core-*-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","*")
- 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","*")
- global hadoop_common_jar_path
- hadoop_common_jar_path = os.path.join(current_dir, "..", "phoenix-assembly", 
"target","*")
- global hadoop_common_jar
- hadoop_common_jar = find("hadoop-common*.jar", hadoop_common_jar_path)
- global hadoop_hdfs_jar_path
- hadoop_hdfs_jar_path = os.path.join(current_dir, "..", "phoenix-assembly", 
"target","*")
- global hadoop_hdfs_jar
- hadoop_hdfs_jar = find("hadoop-hdfs*.jar", hadoop_hdfs_jar_path)
-
- global hbase_conf_dir
- hbase_conf_dir = os.getenv('HBASE_CONF_DIR', os.getenv('HBASE_CONF_PATH', 
'.'))
- global hbase_conf_path # keep conf_path around for backward compatibility
- hbase_conf_path = hbase_conf_dir
- global testjar
- testjar = find(PHOENIX_TESTS_JAR_PATTERN, phoenix_test_jar_path)
- global phoenix_queryserver_jar
- phoenix_queryserver_jar = find(PHOENIX_QUERYSERVER_JAR_PATTERN, 
os.path.join(current_dir, "..", "phoenix-server", "target", "*"))
- global phoenix_thin_client_jar
- phoenix_thin_client_jar = find(PHOENIX_THIN_CLIENT_JAR_PATTERN, 
os.path.join(current_dir, "..", "phoenix-server-client", "target", "*"))
-
- if phoenix_client_jar == "":
- phoenix_client_jar = 
findFileInPathWithoutRecursion(PHOENIX_CLIENT_JAR_PATTERN, 
os.path.join(current_dir, ".."))
-
- if phoenix_thin_client_jar == "":
- phoenix_thin_client_jar = 
findFileInPathWithoutRecursion(PHOENIX_THIN_CLIENT_JAR_PATTERN, 
os.path.join(current_dir, ".."))
-
- if phoenix_queryserver_jar == "":
- phoenix_queryserver_jar = 
findFileInPathWithoutRecursion(PHOENIX_QUERYSERVER_JAR_PATTERN, 
os.path.join(current_dir, "..", "lib"))
-
- 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_JAR_PATTERN, phoenix_class_path)
-
- if testjar == "":
- testjar = find(PHOENIX_TESTS_JAR_PATTERN, phoenix_class_path)
-
- return ""
+PHOENIX_CLIENT_JAR_PATTERN = "phoenix-*-client.jar"
+PHOENIX_THIN_CLIENT_JAR_PATTERN = "phoenix-*-thin-client.jar"
+PHOENIX_QUERYSERVER_JAR_PATTERN = "phoenix-server-*-runnable.jar"
+PHOENIX_TESTS_JAR_PATTERN = "phoenix-core-*-tests*.jar"
+
+# 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','')
+
+global hbase_conf_dir
+hbase_conf_dir = os.ge

[29/50] [abbrv] phoenix git commit: PHOENIX-2008 Integration tests are failing with HBase-1.1.0 because HBASE-13756(Rajeshbabu)

2015-06-15 Thread maryannxue
PHOENIX-2008 Integration tests are failing with HBase-1.1.0 because 
HBASE-13756(Rajeshbabu)


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

Branch: refs/heads/calcite
Commit: a28c1d3b2d31377f70e0a4c661c3c70d8bc99216
Parents: edff624
Author: Rajeshbabu Chintaguntla 
Authored: Sat May 23 23:27:27 2015 +0530
Committer: Rajeshbabu Chintaguntla 
Committed: Sat May 23 23:27:27 2015 +0530

--
 phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java | 2 ++
 1 file changed, 2 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/a28c1d3b/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
--
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java 
b/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
index 54ae670..4aa28c4 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
@@ -620,6 +620,8 @@ public abstract class BaseTest {
 }
 //no point doing sanity checks when running tests.
 conf.setBoolean("hbase.table.sanity.checks", false);
+// Remove this configuration once hbase has HBASE-13756 fix.
+conf.set("hbase.regionserver.msginterval", "30");
 // set the server rpc controller and rpc scheduler factory, used to 
configure the cluster
 conf.set(RpcControllerFactory.CUSTOM_CONTROLLER_CONF_KEY, 
DEFAULT_SERVER_RPC_CONTROLLER_FACTORY);
 conf.set(RSRpcServices.REGION_SERVER_RPC_SCHEDULER_FACTORY_CLASS, 
DEFAULT_RPC_SCHEDULER_FACTORY);



[46/50] [abbrv] phoenix git commit: PHOENIX 1968: Should support saving arrays

2015-06-15 Thread maryannxue
PHOENIX 1968: Should support saving arrays


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

Branch: refs/heads/calcite
Commit: 31a1ca6caefb45430969fc7c0d28b50bb515c605
Parents: db90196
Author: ravimagham 
Authored: Thu Jun 11 11:50:21 2015 -0700
Committer: ravimagham 
Committed: Thu Jun 11 11:50:21 2015 -0700

--
 .../apache/phoenix/spark/PhoenixSparkIT.scala   | 21 
 .../phoenix/spark/PhoenixRecordWritable.scala   | 25 
 2 files changed, 41 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/31a1ca6c/phoenix-spark/src/it/scala/org/apache/phoenix/spark/PhoenixSparkIT.scala
--
diff --git 
a/phoenix-spark/src/it/scala/org/apache/phoenix/spark/PhoenixSparkIT.scala 
b/phoenix-spark/src/it/scala/org/apache/phoenix/spark/PhoenixSparkIT.scala
index 42e8676..5f256e6 100644
--- a/phoenix-spark/src/it/scala/org/apache/phoenix/spark/PhoenixSparkIT.scala
+++ b/phoenix-spark/src/it/scala/org/apache/phoenix/spark/PhoenixSparkIT.scala
@@ -415,4 +415,25 @@ class PhoenixSparkIT extends FunSuite with Matchers with 
BeforeAndAfterAll {
 
 results.toList shouldEqual checkResults
   }
+
+  test("Can save arrays back to phoenix") {
+val dataSet = List((2L, Array("String1", "String2", "String3")))
+
+sc
+  .parallelize(dataSet)
+  .saveToPhoenix(
+"ARRAY_TEST_TABLE",
+Seq("ID","VCARRAY"),
+zkUrl = Some(quorumAddress)
+  )
+
+// Load the results back
+val stmt = conn.createStatement()
+val rs = stmt.executeQuery("SELECT VCARRAY FROM ARRAY_TEST_TABLE WHERE ID 
= 2")
+rs.next()
+val sqlArray = rs.getArray(1).getArray().asInstanceOf[Array[String]]
+
+// Verify the arrays are equal
+sqlArray shouldEqual dataSet(0)._2
+  }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/phoenix/blob/31a1ca6c/phoenix-spark/src/main/scala/org/apache/phoenix/spark/PhoenixRecordWritable.scala
--
diff --git 
a/phoenix-spark/src/main/scala/org/apache/phoenix/spark/PhoenixRecordWritable.scala
 
b/phoenix-spark/src/main/scala/org/apache/phoenix/spark/PhoenixRecordWritable.scala
index 67e0bd2..3977657 100644
--- 
a/phoenix-spark/src/main/scala/org/apache/phoenix/spark/PhoenixRecordWritable.scala
+++ 
b/phoenix-spark/src/main/scala/org/apache/phoenix/spark/PhoenixRecordWritable.scala
@@ -16,11 +16,12 @@ package org.apache.phoenix.spark
 import java.sql.{PreparedStatement, ResultSet}
 import org.apache.hadoop.mapreduce.lib.db.DBWritable
 import org.apache.phoenix.mapreduce.util.ColumnInfoToStringEncoderDecoder
-import org.apache.phoenix.schema.types.{PDate, PhoenixArray}
+import org.apache.phoenix.schema.types.{PDataType, PDate, PhoenixArray}
 import org.joda.time.DateTime
 import scala.collection.{immutable, mutable}
 import scala.collection.JavaConversions._
 
+
 class PhoenixRecordWritable(var encodedColumns: String) extends DBWritable {
   val upsertValues = mutable.ArrayBuffer[Any]()
   val resultMap = mutable.Map[String, AnyRef]()
@@ -44,13 +45,27 @@ class PhoenixRecordWritable(var encodedColumns: String) 
extends DBWritable {
 upsertValues.zip(columns).zipWithIndex.foreach {
   case ((v, c), i) => {
 if (v != null) {
+
   // Both Java and Joda dates used to work in 4.2.3, but now they must 
be java.sql.Date
+  // Can override any other types here as needed
   val (finalObj, finalType) = v match {
-case dt: DateTime => (new java.sql.Date(dt.getMillis), 
PDate.INSTANCE.getSqlType)
-case d: java.util.Date => (new java.sql.Date(d.getTime), 
PDate.INSTANCE.getSqlType)
-case _ => (v, c.getSqlType)
+case dt: DateTime => (new java.sql.Date(dt.getMillis), 
PDate.INSTANCE)
+case d: java.util.Date => (new java.sql.Date(d.getTime), 
PDate.INSTANCE)
+case _ => (v, c.getPDataType)
+  }
+
+  // Save as array or object
+  finalObj match {
+case obj: Array[AnyRef] => {
+  // Create a java.sql.Array, need to lookup the base sql type name
+  val sqlArray = statement.getConnection.createArrayOf(
+PDataType.arrayBaseType(finalType).getSqlTypeName,
+obj
+  )
+  statement.setArray(i + 1, sqlArray)
+}
+case _ => statement.setObject(i + 1, finalObj)
   }
-  statement.setObject(i + 1, finalObj, finalType)
 } else {
   statement.setNull(i + 1, c.getSqlTy

[45/50] [abbrv] phoenix git commit: PHOENIX-2027 Subqueries with no data are raising IllegalStateException(Alicia Ying Shu)

2015-06-15 Thread maryannxue
PHOENIX-2027 Subqueries with no data are raising IllegalStateException(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/db90196d
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/db90196d
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/db90196d

Branch: refs/heads/calcite
Commit: db90196dc2561a220fc376ce01a8ad1ba185bea8
Parents: b3ed60b
Author: Rajeshbabu Chintaguntla 
Authored: Wed Jun 10 01:00:50 2015 +0530
Committer: Rajeshbabu Chintaguntla 
Committed: Wed Jun 10 01:00:50 2015 +0530

--
 .../apache/phoenix/end2end/SortMergeJoinIT.java | 54 
 .../phoenix/execute/SortMergeJoinPlan.java  |  4 +-
 2 files changed, 56 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/db90196d/phoenix-core/src/it/java/org/apache/phoenix/end2end/SortMergeJoinIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SortMergeJoinIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SortMergeJoinIT.java
index 6f14a45..8b65ab3 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SortMergeJoinIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SortMergeJoinIT.java
@@ -2658,5 +2658,59 @@ public class SortMergeJoinIT extends 
BaseHBaseManagedTimeIT {
 }
 }
 
+@Test
+public void testSubqueryWithoutData() throws Exception {
+Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+Connection conn = DriverManager.getConnection(getUrl(), props);
+conn.setAutoCommit(false);
+
+try {
+String GRAMMAR_TABLE = "CREATE TABLE IF NOT EXISTS GRAMMAR_TABLE 
(ID INTEGER PRIMARY KEY, " +
+"unsig_id UNSIGNED_INT, big_id BIGINT, unsig_long_id 
UNSIGNED_LONG, tiny_id TINYINT," +
+"unsig_tiny_id UNSIGNED_TINYINT, small_id SMALLINT, 
unsig_small_id UNSIGNED_SMALLINT," + 
+"float_id FLOAT, unsig_float_id UNSIGNED_FLOAT, double_id 
DOUBLE, unsig_double_id UNSIGNED_DOUBLE," + 
+"decimal_id DECIMAL, boolean_id BOOLEAN, time_id TIME, 
date_id DATE, timestamp_id TIMESTAMP," + 
+"unsig_time_id TIME, unsig_date_id DATE, 
unsig_timestamp_id TIMESTAMP, varchar_id VARCHAR (30)," + 
+"char_id CHAR (30), binary_id BINARY (100), varbinary_id 
VARBINARY (100))";
+
+String LARGE_TABLE = "CREATE TABLE IF NOT EXISTS LARGE_TABLE (ID 
INTEGER PRIMARY KEY, " +
+"unsig_id UNSIGNED_INT, big_id BIGINT, unsig_long_id 
UNSIGNED_LONG, tiny_id TINYINT," +
+"unsig_tiny_id UNSIGNED_TINYINT, small_id SMALLINT, 
unsig_small_id UNSIGNED_SMALLINT," + 
+"float_id FLOAT, unsig_float_id UNSIGNED_FLOAT, double_id 
DOUBLE, unsig_double_id UNSIGNED_DOUBLE," + 
+"decimal_id DECIMAL, boolean_id BOOLEAN, time_id TIME, 
date_id DATE, timestamp_id TIMESTAMP," + 
+"unsig_time_id TIME, unsig_date_id DATE, 
unsig_timestamp_id TIMESTAMP, varchar_id VARCHAR (30)," + 
+"char_id CHAR (30), binary_id BINARY (100), varbinary_id 
VARBINARY (100))";
+
+String SECONDARY_LARGE_TABLE = "CREATE TABLE IF NOT EXISTS 
SECONDARY_LARGE_TABLE (SEC_ID INTEGER PRIMARY KEY," +
+"sec_unsig_id UNSIGNED_INT, sec_big_id BIGINT, 
sec_usnig_long_id UNSIGNED_LONG, sec_tiny_id TINYINT," + 
+"sec_unsig_tiny_id UNSIGNED_TINYINT, sec_small_id 
SMALLINT, sec_unsig_small_id UNSIGNED_SMALLINT," + 
+"sec_float_id FLOAT, sec_unsig_float_id UNSIGNED_FLOAT, 
sec_double_id DOUBLE, sec_unsig_double_id UNSIGNED_DOUBLE," +
+"sec_decimal_id DECIMAL, sec_boolean_id BOOLEAN, 
sec_time_id TIME, sec_date_id DATE," +
+"sec_timestamp_id TIMESTAMP, sec_unsig_time_id TIME, 
sec_unsig_date_id DATE, sec_unsig_timestamp_id TIMESTAMP," +
+"sec_varchar_id VARCHAR (30), sec_char_id CHAR (30), 
sec_binary_id BINARY (100), sec_varbinary_id VARBINARY (100))";
+createTestTable(getUrl(), GRAMMAR_TABLE);
+createTestTable(getUrl(), LARGE_TABLE);
+createTestTable(getUrl(), SECONDARY_LARGE_TABLE);
+
+String ddl = "SELECT /*+USE_SORT_MERGE_JOIN*/ * FROM (SELECT ID, 
BIG_ID, DATE_ID FROM LARGE_TABLE AS A WHERE (A.ID % 5) = 0) AS A " +
+"INNER JOIN (SELECT SEC_ID, SEC_TINY_ID, 
SEC_UNSIG_FLOAT_ID FROM SECONDARY_LARGE_TABLE AS B WHERE (B.SEC_ID % 5) = 0) AS 
B " + 
+"ON A.ID=B.SEC_ID WHERE A.DATE_ID > ALL (SELECT 
SEC_DATE_ID FROM SECONDARY_LARGE_TABLE LIMIT 100) " +  
+"AND B.SEC_UNSIG_FL

[03/50] [abbrv] phoenix git commit: PHOENIX-1930 [BW COMPAT] Queries hangs with client on Phoenix 4.3.0 and server on 4.x-HBase-0.98

2015-06-15 Thread maryannxue
PHOENIX-1930 [BW COMPAT] Queries hangs with client on Phoenix 4.3.0 and server 
on 4.x-HBase-0.98


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

Branch: refs/heads/calcite
Commit: d2c1f2c0a6a0994da296b20158697fa725f1b4a7
Parents: 902cf0d
Author: Thomas 
Authored: Wed Apr 29 15:44:13 2015 -0700
Committer: Thomas 
Committed: Wed Apr 29 16:36:04 2015 -0700

--
 .../main/java/org/apache/phoenix/expression/ExpressionType.java  | 4 
 1 file changed, 4 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/d2c1f2c0/phoenix-core/src/main/java/org/apache/phoenix/expression/ExpressionType.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/ExpressionType.java 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/ExpressionType.java
index 843a768..71f0521 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/ExpressionType.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/ExpressionType.java
@@ -214,6 +214,10 @@ public enum ExpressionType {
 ByteBasedRegexpReplaceFunction(ByteBasedRegexpReplaceFunction.class),
 ByteBasedRegexpSubstrFunction(ByteBasedRegexpSubstrFunction.class),
 ByteBasedRegexpSplitFunction(ByteBasedRegexpSplitFunction.class),
+LikeExpression(LikeExpression.class),
+RegexpReplaceFunction(RegexpReplaceFunction.class),
+RegexpSubstrFunction(RegexpSubstrFunction.class),
+RegexpSplitFunction(RegexpSplitFunction.class),
 SignFunction(SignFunction.class),
 YearFunction(YearFunction.class),
 MonthFunction(MonthFunction.class),



[02/50] [abbrv] phoenix git commit: PHOENIX-1856 Include min row key for each region in stats row -addendum(Ram)

2015-06-15 Thread maryannxue
PHOENIX-1856 Include min row key for each region in stats row -addendum(Ram)


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

Branch: refs/heads/calcite
Commit: 902cf0de317db917ae320193ba51ec3588611ede
Parents: 864faba
Author: Rajeshbabu Chintaguntla 
Authored: Thu Apr 30 02:05:14 2015 +0530
Committer: Rajeshbabu Chintaguntla 
Committed: Thu Apr 30 02:05:14 2015 +0530

--
 .../java/org/apache/phoenix/schema/stats/StatisticsCollector.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/902cf0de/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsCollector.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsCollector.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsCollector.java
index 382cead..8e41d4e 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsCollector.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsCollector.java
@@ -169,7 +169,7 @@ public class StatisticsCollector {
 rowTracker = 
 new ArrayList();
 }
-if (minKey == null) {
+if (minKey == null && !results.isEmpty()) {
 Cell minCell = results.get(0);
 minKey = minCell.getRowArray();
 minKeyOffset =  minCell.getRowOffset();



[13/50] [abbrv] phoenix git commit: PHOENIX-1962 Apply check style to the build

2015-06-15 Thread maryannxue
PHOENIX-1962 Apply check style to the build


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

Branch: refs/heads/calcite
Commit: 978b2322e3e962550c1cddda9910f4f70346aaee
Parents: 93397af
Author: Nick Dimiduk 
Authored: Sat May 9 11:10:54 2015 -0700
Committer: Nick Dimiduk 
Committed: Mon May 11 09:52:00 2015 -0700

--
 phoenix-assembly/pom.xml|   4 +
 phoenix-core/pom.xml|   4 +
 phoenix-flume/pom.xml   |   4 +
 phoenix-pherf/pom.xml   |   1 +
 phoenix-pig/pom.xml |   4 +
 phoenix-server-client/pom.xml   |   4 +
 phoenix-server/pom.xml  |   4 +
 phoenix-spark/pom.xml   |   1 +
 pom.xml |  23 ++
 src/main/config/checkstyle/checker.xml  | 281 +++
 src/main/config/checkstyle/header.txt   |  16 ++
 src/main/config/checkstyle/suppressions.xml |  46 
 12 files changed, 392 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/978b2322/phoenix-assembly/pom.xml
--
diff --git a/phoenix-assembly/pom.xml b/phoenix-assembly/pom.xml
index d743bcf..5a73e7a 100644
--- a/phoenix-assembly/pom.xml
+++ b/phoenix-assembly/pom.xml
@@ -33,6 +33,10 @@
   Assemble Phoenix artifacts
   pom
 
+  
+${project.basedir}/..
+  
+
   
 
   

http://git-wip-us.apache.org/repos/asf/phoenix/blob/978b2322/phoenix-core/pom.xml
--
diff --git a/phoenix-core/pom.xml b/phoenix-core/pom.xml
index a4c052c..65e4f8e 100644
--- a/phoenix-core/pom.xml
+++ b/phoenix-core/pom.xml
@@ -24,6 +24,10 @@
   http://www.apache.org
   
 
+  
+${project.basedir}/..
+  
+
   
 
   

http://git-wip-us.apache.org/repos/asf/phoenix/blob/978b2322/phoenix-flume/pom.xml
--
diff --git a/phoenix-flume/pom.xml b/phoenix-flume/pom.xml
index b8c4b8a..a35e309 100644
--- a/phoenix-flume/pom.xml
+++ b/phoenix-flume/pom.xml
@@ -31,6 +31,10 @@
   phoenix-flume
   Phoenix - Flume
 
+  
+${project.basedir}/..
+  
+
   

   org.apache.phoenix

http://git-wip-us.apache.org/repos/asf/phoenix/blob/978b2322/phoenix-pherf/pom.xml
--
diff --git a/phoenix-pherf/pom.xml b/phoenix-pherf/pom.xml
index 337f69c..1667c66 100644
--- a/phoenix-pherf/pom.xml
+++ b/phoenix-pherf/pom.xml
@@ -30,6 +30,7 @@
 Phoenix - Pherf
 
 
+  ${project.basedir}/..
 
 
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/978b2322/phoenix-pig/pom.xml
--
diff --git a/phoenix-pig/pom.xml b/phoenix-pig/pom.xml
index c1b0985..5005f7c 100644
--- a/phoenix-pig/pom.xml
+++ b/phoenix-pig/pom.xml
@@ -31,6 +31,10 @@
   phoenix-pig
   Phoenix - Pig
 
+  
+${project.basedir}/..
+  
+
   
 
   org.apache.phoenix

http://git-wip-us.apache.org/repos/asf/phoenix/blob/978b2322/phoenix-server-client/pom.xml
--
diff --git a/phoenix-server-client/pom.xml b/phoenix-server-client/pom.xml
index 5e2d32e..e23fcba 100644
--- a/phoenix-server-client/pom.xml
+++ b/phoenix-server-client/pom.xml
@@ -24,6 +24,10 @@
 http://www.apache.org
   
 
+  
+${project.basedir}/..
+  
+
   
 
   

http://git-wip-us.apache.org/repos/asf/phoenix/blob/978b2322/phoenix-server/pom.xml
--
diff --git a/phoenix-server/pom.xml b/phoenix-server/pom.xml
index 4737b63..7dd09aa 100644
--- a/phoenix-server/pom.xml
+++ b/phoenix-server/pom.xml
@@ -24,6 +24,10 @@
 http://www.apache.org
   
 
+  
+${project.basedir}/..
+  
+
   
 
   

http://git-wip-us.apache.org/repos/asf/phoenix/blob/978b2322/phoenix-spark/pom.xml
--
diff --git a/phoenix-spark/pom.xml b/phoenix-spark/pom.xml
index a61ba5b..d267d84 100644
--- a/phoenix-spark/pom.xml
+++ b/phoenix-spark/pom.xml
@@ -37,6 +37,7 @@
 1.3.0
 2.10.4
 2.10
+${project.basedir}/..
   
 
   

http://git-wip-us.apache.org/repos/asf/phoenix/blob/978b2322/pom.xml
--
diff --git a/pom.xml b/pom.xml
index 0371191..23ac578 100644
--- a/pom.xml
+++ b/pom.xml
@@ -76,6 +76,7 @@
 src/main/antlr3
 target/generated-sources/antlr3

[12/50] [abbrv] phoenix git commit: PHOENIX-1958 Minimize memory allocation on new connection

2015-06-15 Thread maryannxue
PHOENIX-1958 Minimize memory allocation on new connection


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

Branch: refs/heads/calcite
Commit: 93397affd75fb5877146ca7b4bb028db301f671e
Parents: cd81738
Author: James Taylor 
Authored: Sat May 9 18:13:49 2015 -0700
Committer: James Taylor 
Committed: Sat May 9 18:13:49 2015 -0700

--
 .../src/main/java/org/apache/phoenix/util/ReadOnlyProps.java| 5 +
 1 file changed, 5 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/93397aff/phoenix-core/src/main/java/org/apache/phoenix/util/ReadOnlyProps.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/util/ReadOnlyProps.java 
b/phoenix-core/src/main/java/org/apache/phoenix/util/ReadOnlyProps.java
index 47137ef..a6fb7a5 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/ReadOnlyProps.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/ReadOnlyProps.java
@@ -27,6 +27,9 @@ import java.util.Properties;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import com.google.common.base.Objects;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.Maps;
@@ -40,6 +43,7 @@ import com.google.common.collect.Maps;
  * @since 1.2.2
  */
 public class ReadOnlyProps implements Iterable> {
+private static final Logger logger = 
LoggerFactory.getLogger(ReadOnlyProps.class);
 public static final ReadOnlyProps EMPTY_PROPS = new ReadOnlyProps();
 private final Map props;
 
@@ -296,6 +300,7 @@ public class ReadOnlyProps implements 
Iterable> {
 String value = entry.getValue().toString();
 String oldValue = props.get(key);
 if (!Objects.equal(oldValue, value)) {
+if (logger.isDebugEnabled()) logger.debug("Creating new 
ReadOnlyProps due to " + key + " with " + oldValue + "!=" + value);
 return new ReadOnlyProps(this, overrides);
 }
 }



[40/50] [abbrv] phoenix git commit: PHOENIX-777 Support null value for fixed length ARRAY (Dumindu Buddhika)

2015-06-15 Thread maryannxue
PHOENIX-777 Support null value for fixed length ARRAY (Dumindu Buddhika)


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

Branch: refs/heads/calcite
Commit: 7f6bf10b2cc54279b9210772323dc8f4d2939a19
Parents: 9e686b7
Author: ramkrishna 
Authored: Tue Jun 2 11:13:44 2015 +0530
Committer: ramkrishna 
Committed: Tue Jun 2 11:13:44 2015 +0530

--
 .../phoenix/end2end/ArraysWithNullsIT.java  | 300 +++
 .../phoenix/compile/ExpressionCompiler.java |   9 +-
 .../apache/phoenix/schema/types/PBinary.java|   2 +-
 .../org/apache/phoenix/schema/types/PChar.java  |   5 +-
 .../org/apache/phoenix/schema/types/PDate.java  |   6 +-
 .../apache/phoenix/schema/types/PDecimal.java   |   3 +
 .../apache/phoenix/schema/types/PTimestamp.java |  17 +-
 .../phoenix/schema/types/PhoenixArray.java  |  51 ++--
 8 files changed, 358 insertions(+), 35 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/7f6bf10b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java
new file mode 100644
index 000..b034193
--- /dev/null
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java
@@ -0,0 +1,300 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.phoenix.end2end;
+
+import static org.junit.Assert.assertEquals;
+
+import java.sql.*;
+
+import org.apache.phoenix.schema.types.PTimestamp;
+import org.apache.phoenix.schema.types.PhoenixArray;
+import org.junit.Test;
+
+public class ArraysWithNullsIT extends BaseClientManagedTimeIT {
+
+@Test
+public void testArrayUpsertIntWithNulls() throws Exception {
+Connection conn = DriverManager.getConnection(getUrl());
+conn.createStatement().execute("CREATE TABLE t1 ( k VARCHAR PRIMARY 
KEY, a INTEGER[])");
+
+PreparedStatement stmt = conn.prepareStatement("UPSERT INTO t1 
VALUES('a',ARRAY[null,3,null])");
+stmt.execute();
+conn.commit();
+
+ResultSet rs = conn.createStatement().executeQuery("Select a from t1 
where k = 'a'");
+rs.next();
+Array array = conn.createArrayOf("INTEGER",new Object[]{null,3,null});
+
+assertEquals(rs.getArray(1),array);
+conn.close();
+
+}
+
+
+
+@Test
+public void testArrayUpsertVarcharWithNulls() throws Exception {
+Connection conn = DriverManager.getConnection(getUrl());
+conn.createStatement().execute("CREATE TABLE t2 ( k VARCHAR PRIMARY 
KEY, a VARCHAR[])");
+
+PreparedStatement stmt = conn.prepareStatement("UPSERT INTO t2 
VALUES('a',ARRAY['10',null])");
+stmt.execute();
+conn.commit();
+
+ResultSet rs = conn.createStatement().executeQuery("Select a from t2 
where k = 'a'");
+rs.next();
+Array array = conn.createArrayOf("VARCHAR",new Object[]{"10",null});
+
+assertEquals(rs.getArray(1),array);
+conn.close();
+
+}
+
+@Test
+public void testArrayUpsertBigIntWithNulls() throws Exception {
+Connection conn = DriverManager.getConnection(getUrl());
+conn.createStatement().execute("CREATE TABLE t3 ( k VARCHAR PRIMARY 
KEY, a BIGINT[])");
+
+PreparedStatement stmt = conn.prepareStatement("UPSERT INTO t3 
VALUES('a',ARRAY[2,null,32335,4])");
+stmt.execute();
+conn.commit();
+
+ResultSet rs = conn.createStatement().executeQuery("Select a from t3 
where k = 'a'");
+rs.next();
+Array array = conn.createArrayOf("BIGINT",new 
Object[]{(long)2,null,(long)32335,(long)4});
+
+assertEquals(rs.getArray(1),array);
+conn.close();
+
+}
+
+@Test
+public void test

[42/50] [abbrv] phoenix git commit: PHOENIX-1987 SIGN built-in function should be order preserving (Shuxiong Ye)

2015-06-15 Thread maryannxue
PHOENIX-1987 SIGN built-in function should be order preserving (Shuxiong Ye)


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

Branch: refs/heads/calcite
Commit: 47466e317db72d651c120b1c04bf687abfe10e34
Parents: 6c3d50a
Author: James Taylor 
Authored: Thu Jun 4 14:24:06 2015 -0700
Committer: James Taylor 
Committed: Thu Jun 4 14:24:06 2015 -0700

--
 .../org/apache/phoenix/expression/function/SignFunction.java| 5 +
 .../java/org/apache/phoenix/expression/SignFunctionTest.java| 3 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/47466e31/phoenix-core/src/main/java/org/apache/phoenix/expression/function/SignFunction.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/SignFunction.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/SignFunction.java
index 0b470f8..a11eaff 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/SignFunction.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/SignFunction.java
@@ -71,4 +71,9 @@ public class SignFunction extends ScalarFunction {
 public String getName() {
 return NAME;
 }
+
+@Override
+public OrderPreserving preservesOrder() {
+return OrderPreserving.YES;
+}
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/47466e31/phoenix-core/src/test/java/org/apache/phoenix/expression/SignFunctionTest.java
--
diff --git 
a/phoenix-core/src/test/java/org/apache/phoenix/expression/SignFunctionTest.java
 
b/phoenix-core/src/test/java/org/apache/phoenix/expression/SignFunctionTest.java
index 37d6e1d..e4a5f80 100644
--- 
a/phoenix-core/src/test/java/org/apache/phoenix/expression/SignFunctionTest.java
+++ 
b/phoenix-core/src/test/java/org/apache/phoenix/expression/SignFunctionTest.java
@@ -54,7 +54,8 @@ public class SignFunctionTest {
 Expression signFunction = new SignFunction(expressions);
 ImmutableBytesWritable ptr = new ImmutableBytesWritable();
 signFunction.evaluate(null, ptr);
-Integer result = (Integer) signFunction.getDataType().toObject(ptr);
+Integer result =
+(Integer) signFunction.getDataType().toObject(ptr, 
signFunction.getSortOrder());
 assertTrue(result.compareTo(expected) == 0);
 }
 



[39/50] [abbrv] phoenix git commit: PHOENIX-2012 RowKeyComparisonFilter logs unencoded data at DEBUG level

2015-06-15 Thread maryannxue
PHOENIX-2012 RowKeyComparisonFilter logs unencoded data at DEBUG level


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

Branch: refs/heads/calcite
Commit: 9e686b758ff735fd9129430cd31fe36993b9711b
Parents: dc3083f
Author: Nick Dimiduk 
Authored: Wed May 27 15:58:32 2015 -0700
Committer: Nick Dimiduk 
Committed: Mon Jun 1 15:54:37 2015 -0700

--
 .../java/org/apache/phoenix/filter/RowKeyComparisonFilter.java  | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/9e686b75/phoenix-core/src/main/java/org/apache/phoenix/filter/RowKeyComparisonFilter.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/filter/RowKeyComparisonFilter.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/filter/RowKeyComparisonFilter.java
index 2e2037b..b7de7ac 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/filter/RowKeyComparisonFilter.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/filter/RowKeyComparisonFilter.java
@@ -73,8 +73,9 @@ public class RowKeyComparisonFilter extends 
BooleanExpressionFilter {
 if (evaluate) {
 inputTuple.setKey(v.getRowArray(), v.getRowOffset(), 
v.getRowLength());
 this.keepRow = Boolean.TRUE.equals(evaluate(inputTuple));
-if (logger.isDebugEnabled()) {
-logger.debug("RowKeyComparisonFilter: " + (this.keepRow ? 
"KEEP" : "FILTER")  + " row " + inputTuple);
+if (logger.isTraceEnabled()) {
+logger.trace("RowKeyComparisonFilter: " + (this.keepRow ? 
"KEEP" : "FILTER")
++ " row " + inputTuple);
 }
 evaluate = false;
 }



[23/50] [abbrv] phoenix git commit: PHOENIX-1964 - Pherf tests write output in module base directory

2015-06-15 Thread maryannxue
PHOENIX-1964 - Pherf tests write output in module base directory


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

Branch: refs/heads/calcite
Commit: d3ff0798f3e87bb489e3c91f7d11813503fe7861
Parents: 981ed47
Author: cmarcel 
Authored: Tue May 19 15:54:52 2015 -0700
Committer: cmarcel 
Committed: Wed May 20 13:36:34 2015 -0700

--
 phoenix-pherf/config/pherf.properties   |  3 ++
 .../org/apache/phoenix/pherf/DataIngestIT.java  |  3 +-
 .../apache/phoenix/pherf/ResultBaseTestIT.java  | 45 ++
 .../java/org/apache/phoenix/pherf/Pherf.java|  7 +--
 .../apache/phoenix/pherf/PherfConstants.java| 50 +++-
 .../phoenix/pherf/loaddata/DataLoader.java  |  2 +-
 .../apache/phoenix/pherf/result/ResultUtil.java |  4 +-
 .../pherf/result/impl/CSVResultHandler.java |  5 +-
 .../pherf/result/impl/ImageResultHandler.java   |  5 +-
 .../pherf/result/impl/XMLResultHandler.java |  6 ++-
 .../apache/phoenix/pherf/util/ResourceList.java | 26 --
 .../pherf/workload/WorkloadExecutor.java|  2 +-
 .../phoenix/pherf/ConfigurationParserTest.java  |  2 +-
 .../org/apache/phoenix/pherf/ResourceTest.java  |  8 ++--
 .../apache/phoenix/pherf/ResultBaseTest.java| 44 +
 .../org/apache/phoenix/pherf/ResultTest.java|  5 +-
 16 files changed, 168 insertions(+), 49 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/d3ff0798/phoenix-pherf/config/pherf.properties
--
diff --git a/phoenix-pherf/config/pherf.properties 
b/phoenix-pherf/config/pherf.properties
index 354707a..1142f9b5 100644
--- a/phoenix-pherf/config/pherf.properties
+++ b/phoenix-pherf/config/pherf.properties
@@ -29,3 +29,6 @@ pherf.default.dataloader.threadpool=0
 # When upserting, this is the max # of rows that will be inserted in a single 
commit
 pherf.default.dataloader.batchsize=1000
 
+# Directory where results from a scenario run will be written
+pherf.default.results.dir=RESULTS
+

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d3ff0798/phoenix-pherf/src/it/java/org/apache/phoenix/pherf/DataIngestIT.java
--
diff --git 
a/phoenix-pherf/src/it/java/org/apache/phoenix/pherf/DataIngestIT.java 
b/phoenix-pherf/src/it/java/org/apache/phoenix/pherf/DataIngestIT.java
index b29656d..2b56f43 100644
--- a/phoenix-pherf/src/it/java/org/apache/phoenix/pherf/DataIngestIT.java
+++ b/phoenix-pherf/src/it/java/org/apache/phoenix/pherf/DataIngestIT.java
@@ -18,7 +18,6 @@
 
 package org.apache.phoenix.pherf;
 
-import org.apache.phoenix.end2end.BaseHBaseManagedTimeIT;
 import org.apache.phoenix.pherf.configuration.Column;
 import org.apache.phoenix.pherf.configuration.DataTypeMapping;
 import org.apache.phoenix.pherf.configuration.Scenario;
@@ -39,7 +38,7 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
-public class DataIngestIT extends BaseHBaseManagedTimeIT {
+public class DataIngestIT extends ResultBaseTestIT {
 protected static PhoenixUtil util = new PhoenixUtil(true);
 static final String matcherScenario = ".*scenario/.*test.*xml";
 static final String matcherSchema = ".*datamodel/.*test.*sql";

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d3ff0798/phoenix-pherf/src/it/java/org/apache/phoenix/pherf/ResultBaseTestIT.java
--
diff --git 
a/phoenix-pherf/src/it/java/org/apache/phoenix/pherf/ResultBaseTestIT.java 
b/phoenix-pherf/src/it/java/org/apache/phoenix/pherf/ResultBaseTestIT.java
new file mode 100644
index 000..6e103b8
--- /dev/null
+++ b/phoenix-pherf/src/it/java/org/apache/phoenix/pherf/ResultBaseTestIT.java
@@ -0,0 +1,45 @@
+/*
+ * 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 a

[14/50] [abbrv] phoenix git commit: PHOENIX-1875 implement ARRAY_PREPEND built in function (Dumindu)

2015-06-15 Thread maryannxue
PHOENIX-1875 implement ARRAY_PREPEND built in function (Dumindu)


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

Branch: refs/heads/calcite
Commit: b5ef25c942fb0f4ab9a6fec66e821c5c3473ea46
Parents: 978b232
Author: ramkrishna 
Authored: Wed May 13 10:46:19 2015 +0530
Committer: ramkrishna 
Committed: Wed May 13 10:46:19 2015 +0530

--
 .../phoenix/end2end/ArrayPrependFunctionIT.java | 652 +++
 .../phoenix/expression/ExpressionType.java  |   4 +-
 .../function/ArrayAppendFunction.java   |  35 +-
 .../function/ArrayModifierFunction.java |  75 +++
 .../function/ArrayPrependFunction.java  |  96 +++
 .../phoenix/schema/types/PArrayDataType.java| 161 -
 .../expression/ArrayPrependFunctionTest.java| 552 
 7 files changed, 1541 insertions(+), 34 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/b5ef25c9/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayPrependFunctionIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayPrependFunctionIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayPrependFunctionIT.java
new file mode 100644
index 000..3145d95
--- /dev/null
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayPrependFunctionIT.java
@@ -0,0 +1,652 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.phoenix.end2end;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.sql.*;
+
+import org.apache.phoenix.schema.TypeMismatchException;
+import org.apache.phoenix.schema.types.PhoenixArray;
+import org.junit.Test;
+
+public class ArrayPrependFunctionIT extends BaseHBaseManagedTimeIT {
+
+private void initTableWithVarArray(Connection conn, String type, Object[] 
objectArray, String value) throws SQLException {
+conn.createStatement().execute("CREATE TABLE t ( k VARCHAR PRIMARY 
KEY, a " + type + "[],b " + type + ")");
+conn.commit();
+PreparedStatement stmt = conn.prepareStatement("UPSERT INTO t 
VALUES(?,?," + value + ")");
+PhoenixArray array = (PhoenixArray) conn.createArrayOf(type, 
objectArray);
+stmt.setString(1, "a");
+stmt.setArray(2, array);
+stmt.execute();
+conn.commit();
+
+}
+
+private void initTables(Connection conn) throws Exception {
+String ddl = "CREATE TABLE regions (region_name VARCHAR PRIMARY 
KEY,varchars VARCHAR[],integers INTEGER[],doubles DOUBLE[],bigints 
BIGINT[],chars CHAR(15)[],double1 DOUBLE,char1 CHAR(17),nullcheck 
INTEGER,chars2 CHAR(15)[])";
+conn.createStatement().execute(ddl);
+String dml = "UPSERT INTO 
regions(region_name,varchars,integers,doubles,bigints,chars,double1,char1,nullcheck,chars2)
 VALUES('SF Bay Area'," +
+"ARRAY['2345','46345','23234']," +
+"ARRAY[2345,46345,23234,456]," +
+"ARRAY[23.45,46.345,23.234,45.6,5.78]," +
+"ARRAY[12,34,56,78,910]," +
+"ARRAY['a','','c','ddd','e']," +
+"23.45," +
+"'wert'," +
+"NULL," +
+"ARRAY['foo','a','','c','ddd','e']" +
+")";
+PreparedStatement stmt = conn.prepareStatement(dml);
+stmt.execute();
+conn.commit();
+}
+
+private void initTablesDesc(Connection conn, String type, String val) 
throws Exception {
+String ddl = "CREATE TABLE regions (pk " + type + " PRIMARY KEY 
DESC,varchars VARCHAR[],integers INTEGER[],doubles DOUBLE[],bigints 
BIGINT[],chars CHAR(15)[],chars2 CHAR(15)[], bools BOOLEAN[])";
+conn.createStatement().execute(ddl);
+String dml = "UPSERT INTO 
regions(pk

[27/50] [abbrv] phoenix git commit: PHOENIX-1681 Use the new Region Interface (Andrew Purtell)

2015-06-15 Thread maryannxue
http://git-wip-us.apache.org/repos/asf/phoenix/blob/edff624f/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsCollector.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsCollector.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsCollector.java
index 272cac6..e7e1dd7 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsCollector.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsCollector.java
@@ -31,8 +31,8 @@ import org.apache.hadoop.hbase.KeyValueUtil;
 import org.apache.hadoop.hbase.client.Mutation;
 import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
 import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
-import org.apache.hadoop.hbase.regionserver.HRegion;
 import org.apache.hadoop.hbase.regionserver.InternalScanner;
+import org.apache.hadoop.hbase.regionserver.Region;
 import org.apache.hadoop.hbase.regionserver.Store;
 import org.apache.hadoop.hbase.util.Pair;
 import org.apache.phoenix.coprocessor.MetaDataProtocol;
@@ -111,7 +111,7 @@ public class StatisticsCollector {
 this.statsTable.close();
 }
 
-public void updateStatistic(HRegion region) {
+public void updateStatistic(Region region) {
 try {
 ArrayList mutations = new ArrayList();
 writeStatsToStatsTable(region, true, mutations, 
TimeKeeper.SYSTEM.getCurrentTime());
@@ -126,7 +126,7 @@ public class StatisticsCollector {
 }
 }
 
-private void writeStatsToStatsTable(final HRegion region,
+private void writeStatsToStatsTable(final Region region,
 boolean delete, List mutations, long currentTime) throws 
IOException {
 try {
 // update the statistics table
@@ -215,7 +215,7 @@ public class StatisticsCollector {
 }
 }
 
-public InternalScanner createCompactionScanner(HRegion region, Store 
store, InternalScanner s) throws IOException {
+public InternalScanner createCompactionScanner(Region region, Store store, 
InternalScanner s) throws IOException {
 // See if this is for Major compaction
 if (logger.isDebugEnabled()) {
 logger.debug("Compaction scanner created for stats");
@@ -224,13 +224,13 @@ public class StatisticsCollector {
 return getInternalScanner(region, store, s, cfKey);
 }
 
-public void splitStats(HRegion parent, HRegion left, HRegion right) {
+public void splitStats(Region parent, Region left, Region right) {
 try {
 if (logger.isDebugEnabled()) {
 logger.debug("Collecting stats for split of " + 
parent.getRegionInfo() + " into " + left.getRegionInfo() + " and " + 
right.getRegionInfo());
 }
 List mutations = Lists.newArrayListWithExpectedSize(3);
-for (byte[] fam : parent.getStores().keySet()) {
+for (byte[] fam : parent.getTableDesc().getFamiliesKeys()) {
statsTable.splitStats(parent, left, right, this, new 
ImmutableBytesPtr(fam), mutations);
 }
 if (logger.isDebugEnabled()) {
@@ -243,7 +243,7 @@ public class StatisticsCollector {
 }
 }
 
-protected InternalScanner getInternalScanner(HRegion region, Store store,
+protected InternalScanner getInternalScanner(Region region, Store store,
 InternalScanner internalScan, ImmutableBytesPtr family) {
 return new StatisticsScanner(this, statsTable, region, internalScan, 
family);
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/edff624f/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsScanner.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsScanner.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsScanner.java
index 0e50923..582c4de 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsScanner.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsScanner.java
@@ -26,9 +26,9 @@ import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.hbase.Cell;
 import org.apache.hadoop.hbase.KeyValue;
 import org.apache.hadoop.hbase.client.Mutation;
-import org.apache.hadoop.hbase.regionserver.HRegion;
 import org.apache.hadoop.hbase.regionserver.InternalScanner;
 import org.apache.hadoop.hbase.regionserver.ScannerContext;
+import org.apache.hadoop.hbase.regionserver.Region;
 import org.apache.phoenix.hbase.index.util.ImmutableBytesPtr;
 
 /**
@@ -38,11 +38,11 @@ public class StatisticsScanner implements InternalScanner {
 private static final Log LOG = LogFactory.getLog(StatisticsScanner.class);
 private InternalScanner delegate;
 private StatisticsWriter stats;
-private HRegion re

[47/50] [abbrv] phoenix git commit: PHOENIX-2033 PQS log environment details on launch

2015-06-15 Thread maryannxue
PHOENIX-2033 PQS log environment details on launch


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

Branch: refs/heads/calcite
Commit: 67fea1665d6ebb963e0dff335f513e4f61cbd22c
Parents: 31a1ca6
Author: Nick Dimiduk 
Authored: Tue Jun 9 17:12:21 2015 -0700
Committer: Nick Dimiduk 
Committed: Fri Jun 12 09:33:56 2015 -0700

--
 .../apache/phoenix/queryserver/server/Main.java | 69 
 1 file changed, 69 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/67fea166/phoenix-server/src/main/java/org/apache/phoenix/queryserver/server/Main.java
--
diff --git 
a/phoenix-server/src/main/java/org/apache/phoenix/queryserver/server/Main.java 
b/phoenix-server/src/main/java/org/apache/phoenix/queryserver/server/Main.java
index 55febc5..9f9bfc7 100644
--- 
a/phoenix-server/src/main/java/org/apache/phoenix/queryserver/server/Main.java
+++ 
b/phoenix-server/src/main/java/org/apache/phoenix/queryserver/server/Main.java
@@ -34,7 +34,12 @@ import org.apache.hadoop.security.SecurityUtil;
 import org.apache.hadoop.util.Tool;
 import org.apache.hadoop.util.ToolRunner;
 
+import java.lang.management.ManagementFactory;
+import java.lang.management.RuntimeMXBean;
 import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
@@ -50,6 +55,11 @@ public final class Main extends Configured implements Tool, 
Runnable {
   "phoenix.queryserver.http.port";
   public static final int DEFAULT_HTTP_PORT = 8765;
 
+  public static final String QUERY_SERVER_ENV_LOGGING_KEY =
+  "phoenix.queryserver.envvars.logging.disabled";
+  public static final String QUERY_SERVER_ENV_LOGGING_SKIPWORDS_KEY =
+  "phoenix.queryserver.envvars.logging.skipwords";
+
   public static final String KEYTAB_FILENAME_KEY = 
"phoenix.queryserver.keytab.file";
   public static final String KERBEROS_PRINCIPAL_KEY = 
"phoenix.queryserver.kerberos.principal";
   public static final String DNS_NAMESERVER_KEY = 
"phoenix.queryserver.dns.nameserver";
@@ -58,12 +68,70 @@ public final class Main extends Configured implements Tool, 
Runnable {
 
   protected static final Log LOG = LogFactory.getLog(Main.class);
 
+  @SuppressWarnings("serial")
+  private static final Set DEFAULT_SKIP_WORDS = new HashSet() {
+{
+  add("secret");
+  add("passwd");
+  add("password");
+  add("credential");
+}
+  };
+
   private final String[] argv;
   private final CountDownLatch runningLatch = new CountDownLatch(1);
   private HttpServer server = null;
   private int retCode = 0;
   private Throwable t = null;
 
+  /**
+   * Log information about the currently running JVM.
+   */
+  public static void logJVMInfo() {
+// Print out vm stats before starting up.
+RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean();
+if (runtime != null) {
+  LOG.info("vmName=" + runtime.getVmName() + ", vmVendor=" +
+  runtime.getVmVendor() + ", vmVersion=" + runtime.getVmVersion());
+  LOG.info("vmInputArguments=" + runtime.getInputArguments());
+}
+  }
+
+  /**
+   * Logs information about the currently running JVM process including
+   * the environment variables. Logging of env vars can be disabled by
+   * setting {@code "phoenix.envvars.logging.disabled"} to {@code "true"}.
+   * If enabled, you can also exclude environment variables containing
+   * certain substrings by setting {@code "phoenix.envvars.logging.skipwords"}
+   * to comma separated list of such substrings.
+   */
+  public static void logProcessInfo(Configuration conf) {
+// log environment variables unless asked not to
+if (conf == null || !conf.getBoolean(QUERY_SERVER_ENV_LOGGING_KEY, false)) 
{
+  Set skipWords = new HashSet(DEFAULT_SKIP_WORDS);
+  if (conf != null) {
+String[] confSkipWords = 
conf.getStrings(QUERY_SERVER_ENV_LOGGING_SKIPWORDS_KEY);
+if (confSkipWords != null) {
+  skipWords.addAll(Arrays.asList(confSkipWords));
+}
+  }
+
+  nextEnv:
+  for (Map.Entry entry : System.getenv().entrySet()) {
+String key = entry.getKey().toLowerCase();
+String value = entry.getValue().toLowerCase();
+// exclude variables which may contain skip words
+for(String skipWord : skipWords) {
+  if (key.contains(skipWord) || value.contains(skipWord))
+continue nextEnv;
+}
+LOG.info("env:"+entry);
+  }
+}
+// and JVM info
+logJVMInfo();
+  }
+
   /** Constr

[08/50] [abbrv] phoenix git commit: PHOENIX-1944 PQS secure login only executed when debug is enabled

2015-06-15 Thread maryannxue
PHOENIX-1944 PQS secure login only executed when debug is enabled


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

Branch: refs/heads/calcite
Commit: b47dcb66055642559b9dd75f5647473329df432f
Parents: 1fa09dc
Author: Nick Dimiduk 
Authored: Fri May 1 14:23:42 2015 -0700
Committer: Nick Dimiduk 
Committed: Fri May 1 14:23:42 2015 -0700

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


http://git-wip-us.apache.org/repos/asf/phoenix/blob/b47dcb66/phoenix-server/src/main/java/org/apache/phoenix/queryserver/server/Main.java
--
diff --git 
a/phoenix-server/src/main/java/org/apache/phoenix/queryserver/server/Main.java 
b/phoenix-server/src/main/java/org/apache/phoenix/queryserver/server/Main.java
index b099f91..55febc5 100644
--- 
a/phoenix-server/src/main/java/org/apache/phoenix/queryserver/server/Main.java
+++ 
b/phoenix-server/src/main/java/org/apache/phoenix/queryserver/server/Main.java
@@ -121,8 +121,8 @@ public final class Main extends Configured implements Tool, 
Runnable {
 if (LOG.isDebugEnabled()) {
   LOG.debug("Login to " + hostname + " using " + 
getConf().get(KEYTAB_FILENAME_KEY)
   + " and principal " + getConf().get(KERBEROS_PRINCIPAL_KEY) + 
".");
-  SecurityUtil.login(getConf(), KEYTAB_FILENAME_KEY, 
KERBEROS_PRINCIPAL_KEY, hostname);
 }
+SecurityUtil.login(getConf(), KEYTAB_FILENAME_KEY, 
KERBEROS_PRINCIPAL_KEY, hostname);
 LOG.info("Login successful.");
   }
   Class factoryClass = getConf().getClass(



[33/50] [abbrv] phoenix git commit: PHOENIX-2013 Apply PHOENIX-1995 to runnable uberjar as well

2015-06-15 Thread maryannxue
PHOENIX-2013 Apply PHOENIX-1995 to runnable uberjar as well


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

Branch: refs/heads/calcite
Commit: 160e9497dcef541af0e0a9aacf93eed9acb7f8ca
Parents: 170e8cc
Author: Nick Dimiduk 
Authored: Wed May 27 11:27:04 2015 -0700
Committer: Nick Dimiduk 
Committed: Wed May 27 11:27:04 2015 -0700

--
 phoenix-server/src/build/query-server-runnable.xml | 9 +
 1 file changed, 9 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/160e9497/phoenix-server/src/build/query-server-runnable.xml
--
diff --git a/phoenix-server/src/build/query-server-runnable.xml 
b/phoenix-server/src/build/query-server-runnable.xml
index e2a3dc4..ef22b14 100644
--- a/phoenix-server/src/build/query-server-runnable.xml
+++ b/phoenix-server/src/build/query-server-runnable.xml
@@ -28,6 +28,15 @@
 jar
   
   false
+  
+
+  
+  metaInf-services
+
+  
   
 
   /



[01/50] [abbrv] phoenix git commit: PHOENIX-1930 [BW COMPAT] Queries hangs with client on Phoenix 4.3.0 and server on 4.x-HBase-0.98

2015-06-15 Thread maryannxue
Repository: phoenix
Updated Branches:
  refs/heads/calcite f9ddb988c -> 62d6720f7


PHOENIX-1930 [BW COMPAT] Queries hangs with client on Phoenix 4.3.0 and server 
on 4.x-HBase-0.98


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

Branch: refs/heads/calcite
Commit: 864faba6d6091136d6776f1d81cd5264d3a0e14e
Parents: 064b7af
Author: Thomas 
Authored: Wed Apr 29 11:16:41 2015 -0700
Committer: Thomas 
Committed: Wed Apr 29 11:42:09 2015 -0700

--
 .../org/apache/phoenix/expression/ExpressionType.java   | 12 
 1 file changed, 4 insertions(+), 8 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/864faba6/phoenix-core/src/main/java/org/apache/phoenix/expression/ExpressionType.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/ExpressionType.java 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/ExpressionType.java
index d5cf745..843a768 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/ExpressionType.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/ExpressionType.java
@@ -143,7 +143,7 @@ public enum ExpressionType {
 SumAggregateFunction(SumAggregateFunction.class),
 MinAggregateFunction(MinAggregateFunction.class),
 MaxAggregateFunction(MaxAggregateFunction.class),
-LikeExpression(LikeExpression.class),
+StringBasedLikeExpression(StringBasedLikeExpression.class),
 NotExpression(NotExpression.class),
 CaseExpression(CaseExpression.class),
 InListExpression(InListExpression.class),
@@ -159,9 +159,9 @@ public enum ExpressionType {
 LongDivideExpression(LongDivideExpression.class),
 DecimalDivideExpression(DecimalDivideExpression.class),
 CoalesceFunction(CoalesceFunction.class),
-RegexpReplaceFunction(RegexpReplaceFunction.class),
+StringBasedRegexpReplaceFunction(StringBasedRegexpReplaceFunction.class),
 SQLTypeNameFunction(SqlTypeNameFunction.class),
-RegexpSubstrFunction(RegexpSubstrFunction.class),
+StringBasedRegexpSubstrFunction(StringBasedRegexpSubstrFunction.class),
 StringConcatExpression(StringConcatExpression.class),
 LengthFunction(LengthFunction.class),
 LTrimFunction(LTrimFunction.class),
@@ -206,7 +206,7 @@ public enum ExpressionType {
 SQLIndexTypeFunction(SQLIndexTypeFunction.class),
 ModulusExpression(ModulusExpression.class),
 DistinctValueAggregateFunction(DistinctValueAggregateFunction.class),
-RegexpSplitFunction(RegexpSplitFunction.class),
+StringBasedRegexpSplitFunction(StringBasedRegexpSplitFunction.class),
 RandomFunction(RandomFunction.class),
 ToTimeFunction(ToTimeFunction.class),
 ToTimestampFunction(ToTimestampFunction.class),
@@ -214,10 +214,6 @@ public enum ExpressionType {
 ByteBasedRegexpReplaceFunction(ByteBasedRegexpReplaceFunction.class),
 ByteBasedRegexpSubstrFunction(ByteBasedRegexpSubstrFunction.class),
 ByteBasedRegexpSplitFunction(ByteBasedRegexpSplitFunction.class),
-StringBasedLikeExpression(StringBasedLikeExpression.class),
-StringBasedRegexpReplaceFunction(StringBasedRegexpReplaceFunction.class),
-StringBasedRegexpSubstrFunction(StringBasedRegexpSubstrFunction.class),
-StringBasedRegexpSplitFunction(StringBasedRegexpSplitFunction.class),
 SignFunction(SignFunction.class),
 YearFunction(YearFunction.class),
 MonthFunction(MonthFunction.class),



[17/50] [abbrv] phoenix git commit: PHOENIX-1963 - Irregular failures in ResultTest#testMonitorResult

2015-06-15 Thread maryannxue
PHOENIX-1963 - Irregular failures in ResultTest#testMonitorResult


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

Branch: refs/heads/calcite
Commit: 289a875bd1cd76b6437ae1400d6c324bfe3e0754
Parents: a1032fb
Author: cmarcel 
Authored: Thu May 14 15:56:46 2015 -0700
Committer: cmarcel 
Committed: Thu May 14 15:57:00 2015 -0700

--
 phoenix-pherf/cluster/pherf.sh  | 2 +-
 .../main/java/org/apache/phoenix/pherf/jmx/MonitorManager.java  | 5 ++---
 .../src/test/java/org/apache/phoenix/pherf/ResultTest.java  | 4 ++--
 phoenix-pherf/standalone/pherf.sh   | 2 +-
 4 files changed, 6 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/289a875b/phoenix-pherf/cluster/pherf.sh
--
diff --git a/phoenix-pherf/cluster/pherf.sh b/phoenix-pherf/cluster/pherf.sh
index aeff856..8d58dfe 100755
--- a/phoenix-pherf/cluster/pherf.sh
+++ b/phoenix-pherf/cluster/pherf.sh
@@ -28,6 +28,6 @@ for f in $PHERF_HOME/lib/*.jar; do
   CLASSPATH=${CLASSPATH}:$f;
 done
 
-CMD="time $}JAVA_HOME}/bin/java ${REMOTE_DEBUG} -Dapp.home=${PHERF_HOME} 
${ENV_PROPS} -Xms512m -Xmx3072m -cp ${CLASSPATH} org.apache.phoenix.pherf.Pherf 
${@}"
+CMD="time ${JAVA_HOME}/bin/java ${REMOTE_DEBUG} -Dapp.home=${PHERF_HOME} 
${ENV_PROPS} -Xms512m -Xmx3072m -cp ${CLASSPATH} org.apache.phoenix.pherf.Pherf 
${@}"
 
 eval $CMD
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/phoenix/blob/289a875b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/jmx/MonitorManager.java
--
diff --git 
a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/jmx/MonitorManager.java 
b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/jmx/MonitorManager.java
index 9f46cf7..6f97551 100644
--- 
a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/jmx/MonitorManager.java
+++ 
b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/jmx/MonitorManager.java
@@ -106,8 +106,9 @@ public class MonitorManager implements Runnable {
 rowCount.getAndIncrement();
 }
 try {
+resultHandler.flush();
 Thread.sleep(getMonitorFrequency());
-} catch (InterruptedException e) {
+} catch (Exception e) {
 Thread.currentThread().interrupt();
 e.printStackTrace();
 }
@@ -117,9 +118,7 @@ public class MonitorManager implements Runnable {
 try {
 isRunning = false;
 if (resultHandler != null) {
-resultHandler.flush();
 resultHandler.close();
-
 }
 } catch (Exception e) {
 throw new FileLoaderRuntimeException("Could not close monitor 
results.", e);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/289a875b/phoenix-pherf/src/test/java/org/apache/phoenix/pherf/ResultTest.java
--
diff --git 
a/phoenix-pherf/src/test/java/org/apache/phoenix/pherf/ResultTest.java 
b/phoenix-pherf/src/test/java/org/apache/phoenix/pherf/ResultTest.java
index 0f4dfd1..c51f0dc 100644
--- a/phoenix-pherf/src/test/java/org/apache/phoenix/pherf/ResultTest.java
+++ b/phoenix-pherf/src/test/java/org/apache/phoenix/pherf/ResultTest.java
@@ -55,7 +55,7 @@ public class ResultTest {
 resultMonitorWriter.write(result);
 resultMonitorWriter.write(result);
 resultMonitorWriter.write(result);
-resultMonitorWriter.flush();
+resultMonitorWriter.close();
 List results = resultMonitorWriter.read();
 assertEquals("Results did not contain row.", results.size(), 3);
 
@@ -72,7 +72,7 @@ public class ResultTest {
 ExecutorService executorService = Executors.newFixedThreadPool(1);
 MonitorManager monitor = new MonitorManager(100);
 Future future = executorService.submit(monitor);
-List records = null;
+List records;
 final int TIMEOUT = 30;
 
 int ct = 0;

http://git-wip-us.apache.org/repos/asf/phoenix/blob/289a875b/phoenix-pherf/standalone/pherf.sh
--
diff --git a/phoenix-pherf/standalone/pherf.sh 
b/phoenix-pherf/standalone/pherf.sh
index e08035a..2b91d2c 100755
--- a/phoenix-pherf/standalone/pherf.sh
+++ b/phoenix-pherf/standalone/pherf.sh
@@ -24

[35/50] [abbrv] phoenix git commit: PHOENIX-2010 Properly validate number of arguments passed to the functions in FunctionParseNode#validate(Rajeshbabu)

2015-06-15 Thread maryannxue
PHOENIX-2010 Properly validate number of arguments passed to the functions in 
FunctionParseNode#validate(Rajeshbabu)


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

Branch: refs/heads/calcite
Commit: b7f138246328ea80ce53fb73539a1e48413a32d2
Parents: 08fc27d
Author: Rajeshbabu Chintaguntla 
Authored: Sun May 31 07:40:16 2015 +0530
Committer: Rajeshbabu Chintaguntla 
Committed: Sun May 31 07:40:16 2015 +0530

--
 .../phoenix/end2end/UserDefinedFunctionsIT.java   | 14 ++
 .../org/apache/phoenix/parse/FunctionParseNode.java   |  4 
 .../main/java/org/apache/phoenix/parse/PFunction.java |  4 +---
 3 files changed, 19 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/b7f13824/phoenix-core/src/it/java/org/apache/phoenix/end2end/UserDefinedFunctionsIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UserDefinedFunctionsIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UserDefinedFunctionsIT.java
index 7dbde3c..868e19d 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UserDefinedFunctionsIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UserDefinedFunctionsIT.java
@@ -442,6 +442,20 @@ public class UserDefinedFunctionsIT extends 
BaseOwnClusterIT{
 rs = stmt.executeQuery("select k from t9 where mysum9(k)=11");
 assertTrue(rs.next());
 assertEquals(1, rs.getInt(1));
+try {
+rs = stmt.executeQuery("select k from t9 where 
mysum9(k,10,'x')=11");
+fail("FunctionNotFoundException should be thrown");
+} catch(FunctionNotFoundException e) {
+} catch(Exception e) {
+fail("FunctionNotFoundException should be thrown");
+}
+try {
+rs = stmt.executeQuery("select mysum9() from t9");
+fail("FunctionNotFoundException should be thrown");
+} catch(FunctionNotFoundException e) {
+} catch(Exception e) {
+fail("FunctionNotFoundException should be thrown");
+}
 stmt.execute("drop function mysum9");
 try {
 rs = stmt.executeQuery("select k from t9 where mysum9(k)=11");

http://git-wip-us.apache.org/repos/asf/phoenix/blob/b7f13824/phoenix-core/src/main/java/org/apache/phoenix/parse/FunctionParseNode.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/parse/FunctionParseNode.java 
b/phoenix-core/src/main/java/org/apache/phoenix/parse/FunctionParseNode.java
index d1001ee..be52d89 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/parse/FunctionParseNode.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/parse/FunctionParseNode.java
@@ -41,6 +41,7 @@ import 
org.apache.phoenix.expression.function.FunctionExpression;
 import org.apache.phoenix.expression.function.UDFExpression;
 import org.apache.phoenix.parse.PFunction.FunctionArgument;
 import org.apache.phoenix.schema.ArgumentTypeMismatchException;
+import org.apache.phoenix.schema.FunctionNotFoundException;
 import org.apache.phoenix.schema.ValueRangeExcpetion;
 import org.apache.phoenix.schema.types.PDataType;
 import org.apache.phoenix.schema.types.PDataTypeFactory;
@@ -133,6 +134,9 @@ public class FunctionParseNode extends CompoundParseNode {
 public List validate(List children, 
StatementContext context) throws SQLException {
 BuiltInFunctionInfo info = this.getInfo();
 BuiltInFunctionArgInfo[] args = info.getArgs();
+if (args.length < children.size() || info.getRequiredArgCount() > 
children.size()) {
+throw new FunctionNotFoundException(this.name);
+}
 if (args.length > children.size()) {
 List moreChildren = new 
ArrayList(children);
 for (int i = children.size(); i < info.getArgs().length; i++) {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/b7f13824/phoenix-core/src/main/java/org/apache/phoenix/parse/PFunction.java
--
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/parse/PFunction.java 
b/phoenix-core/src/main/java/org/apache/phoenix/parse/PFunction.java
index f4bac35..8a95ae7 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/parse/PFunction.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/parse/PFunction.java
@@ -95,9 +95,7 @@ public class PFunction implements PMetaDataEntity {
 }
 
 public PFunction(PFunction function) {
-this(function.getTenantId(), functio

[48/50] [abbrv] phoenix git commit: PHOENIX-2034 Update pre-commit branches

2015-06-15 Thread maryannxue
PHOENIX-2034 Update pre-commit branches


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

Branch: refs/heads/calcite
Commit: bfb0eee75b2ce0edb931599a9b024d3cd7160ae9
Parents: 67fea16
Author: Nick Dimiduk 
Authored: Fri Jun 12 10:06:59 2015 -0700
Committer: Nick Dimiduk 
Committed: Fri Jun 12 10:06:59 2015 -0700

--
 dev/test-patch.properties | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/bfb0eee7/dev/test-patch.properties
--
diff --git a/dev/test-patch.properties b/dev/test-patch.properties
index 6a82eee..53f2ad4 100644
--- a/dev/test-patch.properties
+++ b/dev/test-patch.properties
@@ -27,7 +27,7 @@ MAX_LINE_LENGTH=100
 # All supported branches for testing with precommit build
 # be sure to consider branch name prefixes in the order, ie, 4.x should appear
 # before 4 since the latter is a prefix
-BRANCH_NAMES="3.0 3.2 4.0.1 4.2 4.3 4.x-HBase-0.98 master"
+BRANCH_NAMES="4.4-HBase-0.98 4.4-HBase-1.0 4.4-HBase-1.1 4.x-HBase-0.98 
4.x-HBase-1.0 4.x-HBase-1.1 master"
 
 
 # All supported Hadoop versions that we want to test the compilation with



[28/50] [abbrv] phoenix git commit: PHOENIX-1681 Use the new Region Interface (Andrew Purtell)

2015-06-15 Thread maryannxue
PHOENIX-1681 Use the new Region Interface (Andrew Purtell)


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

Branch: refs/heads/calcite
Commit: edff624f193324762fae04907c551e3d2fec93a3
Parents: 7bc9cce
Author: Enis Soztutar 
Authored: Thu May 21 23:22:54 2015 -0700
Committer: Enis Soztutar 
Committed: Fri May 22 00:16:31 2015 -0700

--
 ...ReplayWithIndexWritesAndCompressedWALIT.java |  4 +-
 .../EndToEndCoveredColumnsIndexBuilderIT.java   |  4 +-
 .../IndexHalfStoreFileReaderGenerator.java  |  9 +-
 .../regionserver/IndexSplitTransaction.java | 65 +-
 .../hbase/regionserver/LocalIndexMerger.java| 16 ++--
 .../hbase/regionserver/LocalIndexSplitter.java  | 11 +--
 .../coprocessor/BaseScannerRegionObserver.java  | 26 +++---
 .../GroupedAggregateRegionObserver.java | 13 +--
 .../coprocessor/MetaDataEndpointImpl.java   | 94 ++--
 .../phoenix/coprocessor/ScanRegionObserver.java | 17 ++--
 .../coprocessor/SequenceRegionObserver.java | 16 ++--
 .../UngroupedAggregateRegionObserver.java   | 29 +++---
 .../hbase/index/covered/data/LocalTable.java|  5 +-
 .../write/ParallelWriterIndexCommitter.java |  8 +-
 .../recovery/PerRegionIndexWriteCache.java  | 10 +--
 .../recovery/StoreFailuresInCachePolicy.java|  4 +-
 .../TrackingParallelWriterIndexCommitter.java   |  8 +-
 .../phoenix/index/PhoenixIndexBuilder.java  |  4 +-
 .../apache/phoenix/index/PhoenixIndexCodec.java | 14 ++-
 .../schema/stats/StatisticsCollector.java   | 14 +--
 .../phoenix/schema/stats/StatisticsScanner.java | 16 ++--
 .../phoenix/schema/stats/StatisticsWriter.java  | 16 ++--
 .../java/org/apache/phoenix/util/IndexUtil.java | 38 
 .../index/covered/TestLocalTableState.java  |  8 +-
 .../index/write/TestWALRecoveryCaching.java | 17 ++--
 .../recovery/TestPerRegionIndexWriteCache.java  |  6 +-
 26 files changed, 230 insertions(+), 242 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/edff624f/phoenix-core/src/it/java/org/apache/hadoop/hbase/regionserver/wal/WALReplayWithIndexWritesAndCompressedWALIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/hadoop/hbase/regionserver/wal/WALReplayWithIndexWritesAndCompressedWALIT.java
 
b/phoenix-core/src/it/java/org/apache/hadoop/hbase/regionserver/wal/WALReplayWithIndexWritesAndCompressedWALIT.java
index 3b8ff29..611ba68 100644
--- 
a/phoenix-core/src/it/java/org/apache/hadoop/hbase/regionserver/wal/WALReplayWithIndexWritesAndCompressedWALIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/hadoop/hbase/regionserver/wal/WALReplayWithIndexWritesAndCompressedWALIT.java
@@ -159,7 +159,7 @@ public class WALReplayWithIndexWritesAndCompressedWALIT {
   }
 
   /**
-   * Test writing edits into an HRegion, closing it, splitting logs, opening 
Region again. Verify
+   * Test writing edits into an region, closing it, splitting logs, opening 
Region again. Verify
* seqids.
* @throws Exception on failure
*/
@@ -183,7 +183,7 @@ public class WALReplayWithIndexWritesAndCompressedWALIT {
 builder.build(htd);
 
 // create the region + its WAL
-HRegion region0 = HRegion.createHRegion(hri, hbaseRootDir, this.conf, htd);
+HRegion region0 = HRegion.createHRegion(hri, hbaseRootDir, this.conf, 
htd); // FIXME: Uses private type
 region0.close();
 region0.getWAL().close();
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/edff624f/phoenix-core/src/it/java/org/apache/phoenix/hbase/index/covered/EndToEndCoveredColumnsIndexBuilderIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/hbase/index/covered/EndToEndCoveredColumnsIndexBuilderIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/hbase/index/covered/EndToEndCoveredColumnsIndexBuilderIT.java
index d90733f..6b2309e 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/hbase/index/covered/EndToEndCoveredColumnsIndexBuilderIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/hbase/index/covered/EndToEndCoveredColumnsIndexBuilderIT.java
@@ -41,7 +41,7 @@ import org.apache.hadoop.hbase.KeyValue;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.client.Put;
-import org.apache.hadoop.hbase.regionserver.HRegion;
+import org.apache.hadoop.hbase.regionserver.Region;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.phoenix.util.EnvironmentEdge;
 import org.apache.phoenix.util.EnvironmentEdgeManager;
@@ -312,7 +312,7 @@ pub

<    5   6   7   8   9   10   11   12   13   14   >