Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-0.98 3668ff08e -> af012458b


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/af012458
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/af012458
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/af012458

Branch: refs/heads/4.x-HBase-0.98
Commit: af012458ba0aa59b297a4538d545d2b198b3bcb8
Parents: 3668ff0
Author: Samarth <[email protected]>
Authored: Thu Sep 1 10:28:10 2016 -0700
Committer: Samarth <[email protected]>
Committed: Thu Sep 1 10:28:10 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/af012458/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 abdcf3b..227374a 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
@@ -794,4 +794,15 @@ public class DateTimeIT extends 
BaseHBaseManagedTimeTableReuseIT {
         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 " + this.tableName + " 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