Hive supports subqueries only in the FROM clause as of now.

https://cwiki.apache.org/confluence/display/Hive/LanguageManual+SubQueries

On Mon, Sep 17, 2012 at 1:03 PM, Amila Maha Arachchi
<amila.m...@gmail.com>wrote:

> Hi folks,
>
> I want to provide the output of a select query to a where clause of
> another query as shown below.
>
> select *
> from TableA
> where TA_timestamp > (select timestmp from TableB where id="hourDim")
>
> Is this possible in hive? When I try to execute this I get the following
> exception.
>
> If this is not possible, is there another way to achieve this?
>
> org.apache.hadoop.hive.ql.parse.ParseException: line 1:43 cannot recognize
> input near 'select' 'timestmp' 'from' in expression specification
>
> at org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:438)
>  at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:417)
> at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:337)
>  at org.apache.hadoop.hive.ql.Driver.run(Driver.java:889)
> at
> org.apache.hadoop.hive.service.HiveServer$HiveServerHandler.execute(HiveServer.java:201)
>  at
> org.apache.hadoop.hive.jdbc.HiveStatement.executeQuery(HiveStatement.java:187)
> at
> org.wso2.carbon.analytics.hive.impl.HiveExecutorServiceImpl$ScriptCallable.call(HiveExecutorServiceImpl.java:323)
>  at
> org.wso2.carbon.analytics.hive.impl.HiveExecutorServiceImpl$ScriptCallable.call(HiveExecutorServiceImpl.java:224)
> at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
>  at java.util.concurrent.FutureTask.run(FutureTask.java:138)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>  at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> at java.lang.Thread.run(Thread.java:662)
>
> Thanks in advance.
>
> Amila.
>
>


-- 
Regards,
Bharath .V
w:http://researchweb.iiit.ac.in/~bharath.v

Reply via email to