Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Threaded View
Hive >> mail # user >> Does hive support nested queries?


Copy link to this message
-
Re: Does hive support nested queries?
Yes, + is an operator.

t1
a b
1 2
3 4

and the result will be:
col
3
7
On Mon, Sep 17, 2012 at 4:43 PM, Amila Maha Arachchi
<[EMAIL PROTECTED]> wrote:
> Hi Bharath,
>
> Thanks for the reply. But I am confused while trying to understand the
> example in the wiki. Example says
>
>
> SELECT col
> FROM (
>   SELECT a+b AS col
>   FROM t1
> ) t2
>
>
> Can you please explain me what is a+b here. Are they two columns from table
> t1?
>
>
> Can you also tell me whether there is another way to achieve my original
> requirement.
>
>
> Thanks,
>
> Amila.
>
>
> On Mon, Sep 17, 2012 at 1:34 PM, bharath vissapragada
> <[EMAIL PROTECTED]> wrote:
>>
>> 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
>> <[EMAIL PROTECTED]> 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
>
>
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB