我试图实现稠密秩函数而不使用窗口函数(稠密秩)。
在中尝试以下查询:
select deptID, salary,
(select count(distinct Salary)
from Employee e
where e.deptID = Employee.deptID and e.salary >= Employee.Salary) as dense_rank
from Employee order by deptID, Salary Desc;
在配置单元中执行此查询时出现以下错误:
NoviableException(244@[435:1:precedenceequalexpression:((lparen precedencebitwiseorexpression逗号)=>PrecedenceEqualExpressionMultiple | precedenceequalexpressionsingle);])在org.antlr.runtime.dfa.noviablelt(dfa。java:158)在org.antlr.runtime.dfa.predict(dfa。java:116)在org.apache.hadoop.hive.ql.parse.hiveparser\u identifiersparser.precenceequalexpression(hiveparser\u identifiersparser。java:8221)在org.apache.hadoop.hive.ql.parse.hiveparser\u identifiersparser.precencenotexpression(hiveparser\u identifiersparser。java:10008)在org.apache.hadoop.hive.ql.parse.hiveparser\u identifiersparser.precendexpression(hiveparser\u identifiersparser。java:10127)在org.apache.hadoop.hive.ql.parse.hiveparser\u identifiersparser.prevenceorexpression(hiveparser\u identifiersparser。java:10286)位于org.apache.hadoop.hive.ql.parse.hiveparser\u identifiersparser.expression(hiveparser\u identifiersparser.expression)。java:6218)在org.apache.hadoop.hive.ql.parse.hiveparser.expression(hiveparser。java:51844)在org.apache.hadoop.hive.ql.parse.hiveparser\u selectclauseparser.selectitem(hiveparser\u selectclauseparser。java:2951)在org.apache.hadoop.hive.ql.parse.hiveparser\u selectclauseparser.selectlist(hiveparser\u selectclauseparser。java:1467)在org.apache.hadoop.hive.ql.parse.hiveparser\u selectclauseparser.selectclause(hiveparser\u selectclauseparser。java:1194) 在org.apache.hadoop.hive.ql.parse.hiveparser.selectclause(hiveparser。java:51847)在org.apache.hadoop.hive.ql.parse.hiveparser.selectstatement(hiveparser.org.apache.hadoop.hive.ql.parse.hiveparser.selectstatement)上。java:45661)在org.apache.hadoop.hive.ql.parse.hiveparser.regularbody(hiveparser。java:45568)在org.apache.hadoop.hive.ql.parse.hiveparser.querystatementexpressionbody(hiveparser。java:44584)在org.apache.hadoop.hive.ql.parse.hiveparser.querystatementexpression(hiveparser。java:44454)在org.apache.hadoop.hive.ql.parse.hiveparser.execstatement(hiveparser。java:1696)在org.apache.hadoop.hive.ql.parse.hiveparser.statement(hiveparser。java:1178)在org.apache.hadoop.hive.ql.parse.parsedriver.parse(parsedriver。java:204)在org.apache.hadoop.hive.ql.parse.parsedriver.parse(parsedriver。java:166)在org.apache.hadoop.hive.ql.driver.compile(driver。java:404)在org.apache.hadoop.hive.ql.driver.compile(driver。java:329)位于org.apache.hadoop.hive.ql.driver.compileinternal(驱动程序。java:1158)在org.apache.hadoop.hive.ql.driver.runinternal(driver。java:1253)在org.apache.hadoop.hive.ql.driver.run(驱动程序。java:1084)在org.apache.hadoop.hive.ql.driver.run(driver。java:1072)在org.apache.hadoop.hive.cli.clidriver.processlocalcmd(clidriver。java:232)在org.apache.hadoop.hive.cli.clidriver.processcmd(clidriver。java:183)在org.apache.hadoop.hive.cli.clidriver.processline(clidriver。java:399)在org.apache.hadoop.hive.cli.clidriver.executedriver(clidriver。java:776)在org.apache.hadoop.hive.cli.clidriver.run(clidriver。java:714)位于org.apache.hadoop.hive.cli.clidriver.main(clidriver。java:641)在sun.reflect.nativemethodaccessorimpl.invoke0(本机方法)在sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl)。java:62)在sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl。java:43)在java.lang.reflect.method.invoke(方法。java:498)在org.apache.hadoop.util.runjar.run(runjar。java:221)在org.apache.hadoop.util.runjar.main(runjar。java:136)失败:parseexception行1:24无法识别表达式中“(”select“count”)附近的输入规范
请告诉我如何克服这个错误,我们可以得到相同的功能,作为密集排名没有使用 dense_rank()
暂无答案!
目前还没有任何答案,快来回答吧!