[ https://issues.apache.org/jira/browse/PHOENIX-1704?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14361453#comment-14361453 ]
James Taylor commented on PHOENIX-1704: --------------------------------------- Thanks for the quick turnaround on the changes, [~ayingshu]. Looks good, except for one minor issue with the test you added (which I neglected to mention before). When you use the YEAR function in a where clause, use it with a column argument as a constant will be evaluated on the client and you won't be exercising the code path I mentioned before. Something like this (and no need for that catch): {code} + @Test + public void testYearFunctionInWhere() throws Exception { + conn.setAutoCommit(false); + try { + String ddl = "create table t1 " + + "( event_id BIGINT NOT NULL, event_date DATE, event VARCHAR, " + + "CONSTRAINT pk PRIMARY KEY (event_id))"; + createTestTable(getUrl(), ddl); + + ddl = "upsert into t1 values (1, to_date('2015-W05'), 'Phoenix meetup')"; + conn.createStatement().execute(ddl); + + ddl = "select * from t1 where YEAR(event_date) = 2015 "; + ResultSet rs = conn.createStatement().executeQuery(ddl); + assertTrue(rs.next()); + assertEquals(1, rs.getLong(1)); + assertEquals(theDate, rs.getDate(2)); + assertEquals("Phoenix meetup", rs.getString(3)); + assertFalse(rs.next()); + } finally { + conn.close(); + } + } {code} > Add year() built-in function > ---------------------------- > > Key: PHOENIX-1704 > URL: https://issues.apache.org/jira/browse/PHOENIX-1704 > Project: Phoenix > Issue Type: Bug > Reporter: Alicia Ying Shu > Assignee: Alicia Ying Shu > Attachments: Phoenix-1704-v1.patch, Phoenix-1704-v2.patch, > Phoenix-1704-v3.patch > > > Support Year() with date and timestamp. -- This message was sent by Atlassian JIRA (v6.3.4#6332)