mysql - Aggregate and Group By in Apache Phoenix -
i trying execute query in apache phoenix using aggregate , groupby function. have executed same query in mysql , works in phoenix tried query based on mysql query failed. please see mysql query , phoenix query below.
mysql:
select id3, id4, name, descr, status, min(date) table1 status = "inactive" group id3, id4, name, descr, status
result:
id3 id4 name descr status min(date)
17773 8001300701101 name1 descr1 inactive 20121202
17785 9100000161822 name3 descr3 inactive 20121201
phoenix query:
there no difference in query between mysql , phoenix.
select id3, id4, name, descr, status, min ( date ) table1 status = 'inactive' group id3, id4, name, descr, status;
but getting below error can 1 explain please?
error: error 1018 (42y27): aggregate may not contain columns not in group by. els_name (state=42y27,code=1018) java.sql.sqlexception: error 1018 (42y27): aggregate may not contain columns not in group by. els_name @ org.apache.phoenix.exception.sqlexceptioncode$factory$1.newexception(sqlexceptioncode.java:361) @ org.apache.phoenix.exception.sqlexceptioninfo.buildexception(sqlexceptioninfo.java:133) @ org.apache.phoenix.compile.expressioncompiler.thrownonaggexpressioninaggexception(expressioncompiler.java:1141) @ org.apache.phoenix.compile.projectioncompiler.compile(projectioncompiler.java:378) @ org.apache.phoenix.compile.querycompiler.compilesingleflatquery(querycompiler.java:490) @ org.apache.phoenix.compile.querycompiler.compilesinglequery(querycompiler.java:447) @ org.apache.phoenix.compile.querycompiler.compile(querycompiler.java:154) @ org.apache.phoenix.jdbc.phoenixstatement$executableselectstatement.compileplan(phoenixstatement.java:331) @ org.apache.phoenix.jdbc.phoenixstatement$executableselectstatement.compileplan(phoenixstatement.java:314) @ org.apache.phoenix.jdbc.phoenixstatement$1.call(phoenixstatement.java:230) @ org.apache.phoenix.jdbc.phoenixstatement$1.call(phoenixstatement.java:226) @ org.apache.phoenix.call.callrunner.run(callrunner.java:53) @ org.apache.phoenix.jdbc.phoenixstatement.executequery(phoenixstatement.java:225) @ org.apache.phoenix.jdbc.phoenixstatement.execute(phoenixstatement.java:1066) @ sqlline.commands.execute(commands.java:822) @ sqlline.commands.sql(commands.java:732) @ sqlline.sqlline.dispatch(sqlline.java:808) @ sqlline.sqlline.begin(sqlline.java:681) @ sqlline.sqlline.start(sqlline.java:398) @ sqlline.sqlline.main(sqlline.java:292
you might want check column naming.
all table, column family , column names uppercased unless double quoted in case case sensitive.
Comments
Post a Comment