git commit: PHOENIX-1237 COALESCE Function - type of second parameter (Vaclav Loffelmann)

2014-09-18 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/3.0 f6f4fca0e - 7829f0e5a


PHOENIX-1237 COALESCE Function - type of second parameter (Vaclav Loffelmann)


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

Branch: refs/heads/3.0
Commit: 7829f0e5a12dcd2bd36eb0d9042a68167d940551
Parents: f6f4fca
Author: James Taylor jtay...@salesforce.com
Authored: Thu Sep 18 15:41:27 2014 -0700
Committer: James Taylor jtay...@salesforce.com
Committed: Thu Sep 18 15:41:27 2014 -0700

--
 .../end2end/ClientTimeArithmeticQueryIT.java|   2 +-
 .../phoenix/end2end/CoalesceFunctionIT.java | 273 ++-
 .../expression/function/CoalesceFunction.java   |  40 ++-
 3 files changed, 293 insertions(+), 22 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/7829f0e5/phoenix-core/src/it/java/org/apache/phoenix/end2end/ClientTimeArithmeticQueryIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ClientTimeArithmeticQueryIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ClientTimeArithmeticQueryIT.java
index 9be6fc1..98b233c 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ClientTimeArithmeticQueryIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ClientTimeArithmeticQueryIT.java
@@ -537,7 +537,7 @@ public class ClientTimeArithmeticQueryIT extends 
BaseQueryIT {
 
 @Test
 public void testCoalesceFunction() throws Exception {
-String query = SELECT entity_id FROM aTable WHERE a_integer  0 and 
coalesce(X_DECIMAL,0.0) = 0.0;
+String query = SELECT entity_id FROM aTable WHERE 
coalesce(X_DECIMAL,0.0) = 0.0;
 Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
 props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 10)); // Execute at timestamp 2
 Connection conn = DriverManager.getConnection(getUrl(), props);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/7829f0e5/phoenix-core/src/it/java/org/apache/phoenix/end2end/CoalesceFunctionIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CoalesceFunctionIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CoalesceFunctionIT.java
index 48808ab..57599e6 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CoalesceFunctionIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CoalesceFunctionIT.java
@@ -19,6 +19,7 @@ package org.apache.phoenix.end2end;
 
 import static org.apache.phoenix.util.TestUtil.ROW6;
 import static org.apache.phoenix.util.TestUtil.ROW7;
+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;
@@ -27,37 +28,285 @@ import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
+import java.sql.SQLException;
 import java.util.Properties;
 
-import org.apache.phoenix.util.PhoenixRuntime;
+import org.apache.phoenix.schema.IllegalDataException;
+import org.apache.phoenix.util.PropertiesUtil;
+import org.junit.Assert;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
-@Category(ClientManagedTimeTest.class)
-public class CoalesceFunctionIT extends BaseClientManagedTimeIT {
+@Category(HBaseManagedTimeTest.class)
+public class CoalesceFunctionIT extends BaseHBaseManagedTimeIT {
+
 @Test
 public void testCoalesce() throws Exception {
-long ts = nextTimestamp();
 String tenantId = getOrganizationId();
-initATableValues(tenantId, getDefaultSplits(tenantId), null, ts);
-Properties props = new Properties();
-props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 1)); // Execute at timestamp 1
+initATableValues(tenantId, getDefaultSplits(tenantId), getUrl());
+Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
 Connection conn = DriverManager.getConnection(getUrl(), props);
 String query = SELECT entity_id, a_integer + COALESCE(x_integer,1) 
FROM ATABLE WHERE organization_id = ? AND a_integer = 6 AND a_integer = 7;
 PreparedStatement statement = conn.prepareStatement(query);
 statement.setString(1, tenantId);
 ResultSet rs = statement.executeQuery();
-
-assertTrue (rs.next());
+
+assertTrue(rs.next());
 assertEquals(ROW6, rs.getString(1));
 assertEquals(7, 

[2/2] git commit: PHOENIX-1237 COALESCE Function - type of second parameter (Vaclav Loffelmann)

2014-09-18 Thread jamestaylor
PHOENIX-1237 COALESCE Function - type of second parameter (Vaclav Loffelmann)


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

Branch: refs/heads/4.0
Commit: c84b5f9251160a4a28267b2e6cb3b3cf5ac93442
Parents: 1280ad4
Author: James Taylor jtay...@salesforce.com
Authored: Thu Sep 18 15:41:27 2014 -0700
Committer: James Taylor jtay...@salesforce.com
Committed: Thu Sep 18 15:44:09 2014 -0700

--
 .../end2end/ClientTimeArithmeticQueryIT.java|   2 +-
 .../phoenix/end2end/CoalesceFunctionIT.java | 273 ++-
 .../expression/function/CoalesceFunction.java   |  40 ++-
 3 files changed, 293 insertions(+), 22 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/c84b5f92/phoenix-core/src/it/java/org/apache/phoenix/end2end/ClientTimeArithmeticQueryIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ClientTimeArithmeticQueryIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ClientTimeArithmeticQueryIT.java
index 9be6fc1..98b233c 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ClientTimeArithmeticQueryIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ClientTimeArithmeticQueryIT.java
@@ -537,7 +537,7 @@ public class ClientTimeArithmeticQueryIT extends 
BaseQueryIT {
 
 @Test
 public void testCoalesceFunction() throws Exception {
-String query = SELECT entity_id FROM aTable WHERE a_integer  0 and 
coalesce(X_DECIMAL,0.0) = 0.0;
+String query = SELECT entity_id FROM aTable WHERE 
coalesce(X_DECIMAL,0.0) = 0.0;
 Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
 props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 10)); // Execute at timestamp 2
 Connection conn = DriverManager.getConnection(getUrl(), props);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/c84b5f92/phoenix-core/src/it/java/org/apache/phoenix/end2end/CoalesceFunctionIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CoalesceFunctionIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CoalesceFunctionIT.java
index 48808ab..57599e6 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CoalesceFunctionIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CoalesceFunctionIT.java
@@ -19,6 +19,7 @@ package org.apache.phoenix.end2end;
 
 import static org.apache.phoenix.util.TestUtil.ROW6;
 import static org.apache.phoenix.util.TestUtil.ROW7;
+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;
@@ -27,37 +28,285 @@ import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
+import java.sql.SQLException;
 import java.util.Properties;
 
-import org.apache.phoenix.util.PhoenixRuntime;
+import org.apache.phoenix.schema.IllegalDataException;
+import org.apache.phoenix.util.PropertiesUtil;
+import org.junit.Assert;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
-@Category(ClientManagedTimeTest.class)
-public class CoalesceFunctionIT extends BaseClientManagedTimeIT {
+@Category(HBaseManagedTimeTest.class)
+public class CoalesceFunctionIT extends BaseHBaseManagedTimeIT {
+
 @Test
 public void testCoalesce() throws Exception {
-long ts = nextTimestamp();
 String tenantId = getOrganizationId();
-initATableValues(tenantId, getDefaultSplits(tenantId), null, ts);
-Properties props = new Properties();
-props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 1)); // Execute at timestamp 1
+initATableValues(tenantId, getDefaultSplits(tenantId), getUrl());
+Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
 Connection conn = DriverManager.getConnection(getUrl(), props);
 String query = SELECT entity_id, a_integer + COALESCE(x_integer,1) 
FROM ATABLE WHERE organization_id = ? AND a_integer = 6 AND a_integer = 7;
 PreparedStatement statement = conn.prepareStatement(query);
 statement.setString(1, tenantId);
 ResultSet rs = statement.executeQuery();
-
-assertTrue (rs.next());
+
+assertTrue(rs.next());
 assertEquals(ROW6, rs.getString(1));
 assertEquals(7, rs.getInt(2));
-
-assertTrue (rs.next());
+
+

[2/2] git commit: PHOENIX-1237 COALESCE Function - type of second parameter (Vaclav Loffelmann)

2014-09-18 Thread jamestaylor
PHOENIX-1237 COALESCE Function - type of second parameter (Vaclav Loffelmann)


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

Branch: refs/heads/master
Commit: 797af91a6b77e3cbea51ec94ba5a01762efa293c
Parents: bba2eee
Author: James Taylor jtay...@salesforce.com
Authored: Thu Sep 18 15:41:27 2014 -0700
Committer: James Taylor jtay...@salesforce.com
Committed: Thu Sep 18 15:46:29 2014 -0700

--
 .../end2end/ClientTimeArithmeticQueryIT.java|   2 +-
 .../phoenix/end2end/CoalesceFunctionIT.java | 273 ++-
 .../expression/function/CoalesceFunction.java   |  40 ++-
 3 files changed, 293 insertions(+), 22 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/797af91a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ClientTimeArithmeticQueryIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ClientTimeArithmeticQueryIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ClientTimeArithmeticQueryIT.java
index 9be6fc1..98b233c 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ClientTimeArithmeticQueryIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ClientTimeArithmeticQueryIT.java
@@ -537,7 +537,7 @@ public class ClientTimeArithmeticQueryIT extends 
BaseQueryIT {
 
 @Test
 public void testCoalesceFunction() throws Exception {
-String query = SELECT entity_id FROM aTable WHERE a_integer  0 and 
coalesce(X_DECIMAL,0.0) = 0.0;
+String query = SELECT entity_id FROM aTable WHERE 
coalesce(X_DECIMAL,0.0) = 0.0;
 Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
 props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 10)); // Execute at timestamp 2
 Connection conn = DriverManager.getConnection(getUrl(), props);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/797af91a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CoalesceFunctionIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CoalesceFunctionIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CoalesceFunctionIT.java
index 48808ab..57599e6 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CoalesceFunctionIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CoalesceFunctionIT.java
@@ -19,6 +19,7 @@ package org.apache.phoenix.end2end;
 
 import static org.apache.phoenix.util.TestUtil.ROW6;
 import static org.apache.phoenix.util.TestUtil.ROW7;
+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;
@@ -27,37 +28,285 @@ import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
+import java.sql.SQLException;
 import java.util.Properties;
 
-import org.apache.phoenix.util.PhoenixRuntime;
+import org.apache.phoenix.schema.IllegalDataException;
+import org.apache.phoenix.util.PropertiesUtil;
+import org.junit.Assert;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
-@Category(ClientManagedTimeTest.class)
-public class CoalesceFunctionIT extends BaseClientManagedTimeIT {
+@Category(HBaseManagedTimeTest.class)
+public class CoalesceFunctionIT extends BaseHBaseManagedTimeIT {
+
 @Test
 public void testCoalesce() throws Exception {
-long ts = nextTimestamp();
 String tenantId = getOrganizationId();
-initATableValues(tenantId, getDefaultSplits(tenantId), null, ts);
-Properties props = new Properties();
-props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 1)); // Execute at timestamp 1
+initATableValues(tenantId, getDefaultSplits(tenantId), getUrl());
+Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
 Connection conn = DriverManager.getConnection(getUrl(), props);
 String query = SELECT entity_id, a_integer + COALESCE(x_integer,1) 
FROM ATABLE WHERE organization_id = ? AND a_integer = 6 AND a_integer = 7;
 PreparedStatement statement = conn.prepareStatement(query);
 statement.setString(1, tenantId);
 ResultSet rs = statement.executeQuery();
-
-assertTrue (rs.next());
+
+assertTrue(rs.next());
 assertEquals(ROW6, rs.getString(1));
 assertEquals(7, rs.getInt(2));
-
-assertTrue (rs.next());
+
+