Repository: phoenix
Updated Branches:
  refs/heads/4.8-HBase-1.2 f0b4b5b8f -> 1a08947ba


PHOENIX-2793 Test case for date-time functions on null dates return no data 
(Kevin Liew)


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

Branch: refs/heads/4.8-HBase-1.2
Commit: 1a08947ba6a8206565e853f4f00c8859b2d5d1eb
Parents: f0b4b5b
Author: Samarth <[email protected]>
Authored: Thu Sep 1 10:38:48 2016 -0700
Committer: Samarth <[email protected]>
Committed: Thu Sep 1 10:38:48 2016 -0700

----------------------------------------------------------------------
 .../it/java/org/apache/phoenix/end2end/DateTimeIT.java   | 11 +++++++++++
 1 file changed, 11 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/1a08947b/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 7ffc54f..7e01e54 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
@@ -776,4 +776,15 @@ public class DateTimeIT extends BaseHBaseManagedTimeIT {
         assertEquals(false, rs.getBoolean(1));
         assertFalse(rs.next());
     }
+    
+    @Test
+    public void testFunctionOnNullDate() throws Exception {
+        ResultSet rs = conn.createStatement().executeQuery("SELECT 
YEAR(a_date), entity_id from " + ATABLE_NAME + " WHERE entity_id = '" + ROW10 + 
"'");
+        assertNotNull(rs);
+        assertTrue(rs.next());
+        assertEquals(ROW10, rs.getString(2));
+        assertNull(rs.getDate(1));
+        assertNull(rs.getDate(1, GregorianCalendar.getInstance()));
+        assertFalse(rs.next());
+    }
 }

Reply via email to