[ https://issues.apache.org/jira/browse/PHOENIX-1704?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14359913#comment-14359913 ]
Serhiy Bilousov commented on PHOENIX-1704: ------------------------------------------ [~jamestaylor], should this have some attention or I am just doing it wrong? Also please notice how column names does not reflect what was specified in sql statement. This will prevent from being able to group by on expression. for example {noformat} select CAST(TRUNC(timestamp_field,'HOUR') AS TIMESTAMP) t, count(*) from t GROUP BY 2; Error: ERROR 1018 (42Y27): Aggregate may not contain columns not in GROUP BY. TO_TIMESTAMP(FLOOR(timestamp_field)) (state=42Y27,code=1018) {noformat} or this {noformat} select CAST(TRUNC(current_date(),'HOUR') AS TIMESTAMP) t, count(*) from system.catalog GROUP BY CAST(TRUNC(current_date(),'HOUR') AS TIMESTAMP) ; java.lang.NullPointerException at org.apache.phoenix.compile.TrackOrderPreservingExpressionCompiler.getColumnPKPosition(TrackOrderPreservingExpressionCompiler.java:187) at org.apache.phoenix.compile.TrackOrderPreservingExpressionCompiler.access$100(TrackOrderPreservingExpressionCompiler.java:54) at org.apache.phoenix.compile.TrackOrderPreservingExpressionCompiler$Entry.getPkPosition(TrackOrderPreservingExpressionCompiler.java:238) at org.apache.phoenix.compile.TrackOrderPreservingExpressionCompiler.isOrderPreserving(TrackOrderPreservingExpressionCompiler.java:103) at org.apache.phoenix.compile.GroupByCompiler.compile(GroupByCompiler.java:182) at org.apache.phoenix.compile.QueryCompiler.compileSingleFlatQuery(QueryCompiler.java:476) at org.apache.phoenix.compile.QueryCompiler.compileSingleQuery(QueryCompiler.java:447) at org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:152) at org.apache.phoenix.jdbc.PhoenixStatement$ExecutableSelectStatement.compilePlan(PhoenixStatement.java:330) at org.apache.phoenix.jdbc.PhoenixStatement$ExecutableSelectStatement.compilePlan(PhoenixStatement.java:313) at org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:229) at org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:225) at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53) at org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:224) at org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1065) at sqlline.SqlLine$Commands.execute(SqlLine.java:3755) at sqlline.SqlLine$Commands.sql(SqlLine.java:3663) at sqlline.SqlLine.dispatch(SqlLine.java:889) at sqlline.SqlLine.begin(SqlLine.java:763) at sqlline.SqlLine.start(SqlLine.java:498) at sqlline.SqlLine.main(SqlLine.java:460) {noformat} > 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 > > > Support Year() with date and timestamp. -- This message was sent by Atlassian JIRA (v6.3.4#6332)