[ https://issues.apache.org/jira/browse/HIVE-8960?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15429315#comment-15429315 ]
Vikash Pareek commented on HIVE-8960: ------------------------------------- I am trying following query, it is working in Impala but not in Hive. SELECT t1.col1 FROM table1 t1 LEFT OUTER JOIN table2 t2 ON (t1.col2 = t2.col2 AND t1.col3 = t2.col3) WHERE t2.col4 = (SELECT MAX(t22.col4) FROM table2 t22 WHERE t22.col4 <= t1.col4); Is there any alternative for this in Hive? > ParsingException in the WHERE statement with a Sub Query > -------------------------------------------------------- > > Key: HIVE-8960 > URL: https://issues.apache.org/jira/browse/HIVE-8960 > Project: Hive > Issue Type: Bug > Components: Parser > Affects Versions: 0.13.0 > Environment: Secured HDP 2.1.3 with Hive 0.13.0 > Reporter: Rémy SAISSY > > Comparison with a Sub query in a WHERE statement does not work. > Given that id_chargement is an integer: > USE db1; > SELECT * FROM tbl1 a WHERE a.id_chargement > (SELECT MAX(b.id_chargement) > FROM tbl2 b); > or > SELECT * FROM tbl1 a WHERE a.id_chargement > (SELECT b.id_chargement FROM > tbl2 b LIMIT 1); > Both return the following parsing error: > Error: Error while compiling statement: FAILED: ParseException line 1:88 > cannot recognize input near 'SELECT' 'b' '.' in expression specification > (state=42000,code=40000) > java.sql.SQLException: Error while compiling statement: FAILED: > ParseException line 1:88 cannot recognize input near 'SELECT' 'b' '.' in > expression specification > at org.apache.hive.jdbc.Utils.verifySuccess(Utils.java:121) > at org.apache.hive.jdbc.Utils.verifySuccessWithInfo(Utils.java:109) > at org.apache.hive.jdbc.HiveStatement.execute(HiveStatement.java:231) > at org.apache.hive.beeline.Commands.execute(Commands.java:736) > at org.apache.hive.beeline.Commands.sql(Commands.java:657) > at org.apache.hive.beeline.BeeLine.dispatch(BeeLine.java:804) > at org.apache.hive.beeline.BeeLine.begin(BeeLine.java:659) > at > org.apache.hive.beeline.BeeLine.mainWithInputRedirection(BeeLine.java:368) > at org.apache.hive.beeline.BeeLine.main(BeeLine.java:351) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:601) > at org.apache.hadoop.util.RunJar.main(RunJar.java:212) -- This message was sent by Atlassian JIRA (v6.3.4#6332)