[45/50] [abbrv] phoenix git commit: PHOENIX-2039 ROUND over numeric in GROUP BY always returns null (testcase only)-Ram
PHOENIX-2039 ROUND over numeric in GROUP BY always returns null (testcase only)-Ram Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/ef34d1d4 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/ef34d1d4 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/ef34d1d4 Branch: refs/heads/4.x-HBase-1.0 Commit: ef34d1d44fa43087e6b57ffd0185ba3d85f97f9a Parents: 316871b Author: ramkrishna Authored: Tue Jan 5 17:48:06 2016 +0530 Committer: ramkrishna Committed: Tue Jan 5 22:13:02 2016 +0530 -- .../RoundFloorCeilFunctionsEnd2EndIT.java | 38 1 file changed, 38 insertions(+) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/ef34d1d4/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 42635c6..cd00354 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 @@ -17,6 +17,7 @@ */ package org.apache.phoenix.end2end; +import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES; import static org.apache.phoenix.util.TestUtil.closeStmtAndConn; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; @@ -27,6 +28,7 @@ import java.sql.Date; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; +import java.sql.SQLException; import java.sql.Time; import java.sql.Timestamp; import java.util.Properties; @@ -36,6 +38,8 @@ import org.apache.phoenix.expression.function.FloorFunction; import org.apache.phoenix.expression.function.RoundFunction; import org.apache.phoenix.query.QueryServices; import org.apache.phoenix.util.DateUtil; +import org.apache.phoenix.util.PhoenixRuntime; +import org.apache.phoenix.util.PropertiesUtil; import org.junit.Before; import org.junit.Test; @@ -554,4 +558,38 @@ public class RoundFloorCeilFunctionsEnd2EndIT extends BaseHBaseManagedTimeIT { } } + @Test + public void testRoundOffFunction() throws SQLException { +long ts = nextTimestamp(); +Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); +props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 10)); +Connection conn = DriverManager.getConnection(getUrl(), props); +String ddl = "create table round_test(k bigint primary key)"; +conn.createStatement().execute(ddl); +conn.close(); + +props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 30)); +conn = DriverManager.getConnection(getUrl(), props); +PreparedStatement stmt = conn.prepareStatement("upsert into round_test values(1380603308885)"); +stmt.execute(); +conn.commit(); +conn.close(); + + +props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 40)); +conn = DriverManager.getConnection(getUrl(), props); +ResultSet rs; +stmt = conn.prepareStatement("select round(k/100,0) from round_test"); +rs = stmt.executeQuery(); +assertTrue(rs.next()); +assertEquals(1380603, rs.getLong(1)); + +props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 40)); +conn = DriverManager.getConnection(getUrl(), props); +stmt = conn.prepareStatement("select round(k/100,0) x from round_test group by x"); +rs = stmt.executeQuery(); +assertTrue(rs.next()); +assertEquals(1380603, rs.getLong(1)); + } + }
phoenix git commit: PHOENIX-2039 ROUND over numeric in GROUP BY always returns null (testcase only)-Ram
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-0.98 29435eef2 -> b76c076c0 PHOENIX-2039 ROUND over numeric in GROUP BY always returns null (testcase only)-Ram Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/b76c076c Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/b76c076c Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/b76c076c Branch: refs/heads/4.x-HBase-0.98 Commit: b76c076c0d9b5a349b8300dbb8a84ab0529cbc6d Parents: 29435ee Author: ramkrishna Authored: Tue Jan 5 17:48:06 2016 +0530 Committer: ramkrishna Committed: Tue Jan 5 22:13:36 2016 +0530 -- .../RoundFloorCeilFunctionsEnd2EndIT.java | 38 1 file changed, 38 insertions(+) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/b76c076c/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 42635c6..cd00354 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 @@ -17,6 +17,7 @@ */ package org.apache.phoenix.end2end; +import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES; import static org.apache.phoenix.util.TestUtil.closeStmtAndConn; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; @@ -27,6 +28,7 @@ import java.sql.Date; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; +import java.sql.SQLException; import java.sql.Time; import java.sql.Timestamp; import java.util.Properties; @@ -36,6 +38,8 @@ import org.apache.phoenix.expression.function.FloorFunction; import org.apache.phoenix.expression.function.RoundFunction; import org.apache.phoenix.query.QueryServices; import org.apache.phoenix.util.DateUtil; +import org.apache.phoenix.util.PhoenixRuntime; +import org.apache.phoenix.util.PropertiesUtil; import org.junit.Before; import org.junit.Test; @@ -554,4 +558,38 @@ public class RoundFloorCeilFunctionsEnd2EndIT extends BaseHBaseManagedTimeIT { } } + @Test + public void testRoundOffFunction() throws SQLException { +long ts = nextTimestamp(); +Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); +props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 10)); +Connection conn = DriverManager.getConnection(getUrl(), props); +String ddl = "create table round_test(k bigint primary key)"; +conn.createStatement().execute(ddl); +conn.close(); + +props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 30)); +conn = DriverManager.getConnection(getUrl(), props); +PreparedStatement stmt = conn.prepareStatement("upsert into round_test values(1380603308885)"); +stmt.execute(); +conn.commit(); +conn.close(); + + +props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 40)); +conn = DriverManager.getConnection(getUrl(), props); +ResultSet rs; +stmt = conn.prepareStatement("select round(k/100,0) from round_test"); +rs = stmt.executeQuery(); +assertTrue(rs.next()); +assertEquals(1380603, rs.getLong(1)); + +props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 40)); +conn = DriverManager.getConnection(getUrl(), props); +stmt = conn.prepareStatement("select round(k/100,0) x from round_test group by x"); +rs = stmt.executeQuery(); +assertTrue(rs.next()); +assertEquals(1380603, rs.getLong(1)); + } + }
phoenix git commit: PHOENIX-2039 ROUND over numeric in GROUP BY always returns null (testcase only)-Ram
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-1.0 316871ba4 -> ef34d1d44 PHOENIX-2039 ROUND over numeric in GROUP BY always returns null (testcase only)-Ram Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/ef34d1d4 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/ef34d1d4 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/ef34d1d4 Branch: refs/heads/4.x-HBase-1.0 Commit: ef34d1d44fa43087e6b57ffd0185ba3d85f97f9a Parents: 316871b Author: ramkrishna Authored: Tue Jan 5 17:48:06 2016 +0530 Committer: ramkrishna Committed: Tue Jan 5 22:13:02 2016 +0530 -- .../RoundFloorCeilFunctionsEnd2EndIT.java | 38 1 file changed, 38 insertions(+) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/ef34d1d4/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 42635c6..cd00354 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 @@ -17,6 +17,7 @@ */ package org.apache.phoenix.end2end; +import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES; import static org.apache.phoenix.util.TestUtil.closeStmtAndConn; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; @@ -27,6 +28,7 @@ import java.sql.Date; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; +import java.sql.SQLException; import java.sql.Time; import java.sql.Timestamp; import java.util.Properties; @@ -36,6 +38,8 @@ import org.apache.phoenix.expression.function.FloorFunction; import org.apache.phoenix.expression.function.RoundFunction; import org.apache.phoenix.query.QueryServices; import org.apache.phoenix.util.DateUtil; +import org.apache.phoenix.util.PhoenixRuntime; +import org.apache.phoenix.util.PropertiesUtil; import org.junit.Before; import org.junit.Test; @@ -554,4 +558,38 @@ public class RoundFloorCeilFunctionsEnd2EndIT extends BaseHBaseManagedTimeIT { } } + @Test + public void testRoundOffFunction() throws SQLException { +long ts = nextTimestamp(); +Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); +props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 10)); +Connection conn = DriverManager.getConnection(getUrl(), props); +String ddl = "create table round_test(k bigint primary key)"; +conn.createStatement().execute(ddl); +conn.close(); + +props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 30)); +conn = DriverManager.getConnection(getUrl(), props); +PreparedStatement stmt = conn.prepareStatement("upsert into round_test values(1380603308885)"); +stmt.execute(); +conn.commit(); +conn.close(); + + +props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 40)); +conn = DriverManager.getConnection(getUrl(), props); +ResultSet rs; +stmt = conn.prepareStatement("select round(k/100,0) from round_test"); +rs = stmt.executeQuery(); +assertTrue(rs.next()); +assertEquals(1380603, rs.getLong(1)); + +props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 40)); +conn = DriverManager.getConnection(getUrl(), props); +stmt = conn.prepareStatement("select round(k/100,0) x from round_test group by x"); +rs = stmt.executeQuery(); +assertTrue(rs.next()); +assertEquals(1380603, rs.getLong(1)); + } + }
phoenix git commit: PHOENIX-2039 ROUND over numeric in GROUP BY always returns null (testcase only)-Ram
Repository: phoenix Updated Branches: refs/heads/master 3e41fe397 -> ab8fa5ef4 PHOENIX-2039 ROUND over numeric in GROUP BY always returns null (testcase only)-Ram Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/ab8fa5ef Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/ab8fa5ef Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/ab8fa5ef Branch: refs/heads/master Commit: ab8fa5ef436588d8f285f6e8c4bf8e79edbd71ed Parents: 3e41fe3 Author: ramkrishna Authored: Tue Jan 5 17:48:06 2016 +0530 Committer: ramkrishna Committed: Tue Jan 5 17:49:23 2016 +0530 -- .../RoundFloorCeilFunctionsEnd2EndIT.java | 38 1 file changed, 38 insertions(+) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/ab8fa5ef/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 42635c6..cd00354 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 @@ -17,6 +17,7 @@ */ package org.apache.phoenix.end2end; +import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES; import static org.apache.phoenix.util.TestUtil.closeStmtAndConn; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; @@ -27,6 +28,7 @@ import java.sql.Date; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; +import java.sql.SQLException; import java.sql.Time; import java.sql.Timestamp; import java.util.Properties; @@ -36,6 +38,8 @@ import org.apache.phoenix.expression.function.FloorFunction; import org.apache.phoenix.expression.function.RoundFunction; import org.apache.phoenix.query.QueryServices; import org.apache.phoenix.util.DateUtil; +import org.apache.phoenix.util.PhoenixRuntime; +import org.apache.phoenix.util.PropertiesUtil; import org.junit.Before; import org.junit.Test; @@ -554,4 +558,38 @@ public class RoundFloorCeilFunctionsEnd2EndIT extends BaseHBaseManagedTimeIT { } } + @Test + public void testRoundOffFunction() throws SQLException { +long ts = nextTimestamp(); +Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); +props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 10)); +Connection conn = DriverManager.getConnection(getUrl(), props); +String ddl = "create table round_test(k bigint primary key)"; +conn.createStatement().execute(ddl); +conn.close(); + +props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 30)); +conn = DriverManager.getConnection(getUrl(), props); +PreparedStatement stmt = conn.prepareStatement("upsert into round_test values(1380603308885)"); +stmt.execute(); +conn.commit(); +conn.close(); + + +props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 40)); +conn = DriverManager.getConnection(getUrl(), props); +ResultSet rs; +stmt = conn.prepareStatement("select round(k/100,0) from round_test"); +rs = stmt.executeQuery(); +assertTrue(rs.next()); +assertEquals(1380603, rs.getLong(1)); + +props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 40)); +conn = DriverManager.getConnection(getUrl(), props); +stmt = conn.prepareStatement("select round(k/100,0) x from round_test group by x"); +rs = stmt.executeQuery(); +assertTrue(rs.next()); +assertEquals(1380603, rs.getLong(1)); + } + }