You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by Ashok Kumar <as...@yahoo.com.INVALID> on 2016/02/25 12:23:38 UTC

select * from mytable where column1 in (select max(column1) from mytable)

 Hi,
What is the equivalent of this in Spark please
select * from mytable where column1 in (select max(column1) from mytable)
Thanks

Re: select * from mytable where column1 in (select max(column1) from mytable)

Posted by ayan guha <gu...@gmail.com>.
But can't I just use HiveContext and use hive's functionality, which does
support subqueries?

On Fri, Feb 26, 2016 at 4:28 PM, Mohammad Tariq <do...@gmail.com> wrote:

> Spark doesn't support subqueries in WHERE clause, IIRC. It supports
> subqueries only in the FROM clause as of now. See this ticket
> <https://issues.apache.org/jira/browse/SPARK-4226> for more on this.
>
>
>
> [image: http://]
>
> Tariq, Mohammad
> about.me/mti
> [image: http://]
> <http://about.me/mti>
>
>
> On Fri, Feb 26, 2016 at 7:01 AM, ayan guha <gu...@gmail.com> wrote:
>
>> Why is this not working for you? Are you trying on dataframe? What error
>> are you getting?
>>
>> On Thu, Feb 25, 2016 at 10:23 PM, Ashok Kumar <
>> ashok34668@yahoo.com.invalid> wrote:
>>
>>> Hi,
>>>
>>> What is the equivalent of this in Spark please
>>>
>>> select * from mytable where column1 in (select max(column1) from mytable)
>>>
>>> Thanks
>>>
>>
>>
>>
>> --
>> Best Regards,
>> Ayan Guha
>>
>
>


-- 
Best Regards,
Ayan Guha

Re: select * from mytable where column1 in (select max(column1) from mytable)

Posted by Mohammad Tariq <do...@gmail.com>.
Spark doesn't support subqueries in WHERE clause, IIRC. It supports
subqueries only in the FROM clause as of now. See this ticket
<https://issues.apache.org/jira/browse/SPARK-4226> for more on this.



[image: http://]

Tariq, Mohammad
about.me/mti
[image: http://]
<http://about.me/mti>


On Fri, Feb 26, 2016 at 7:01 AM, ayan guha <gu...@gmail.com> wrote:

> Why is this not working for you? Are you trying on dataframe? What error
> are you getting?
>
> On Thu, Feb 25, 2016 at 10:23 PM, Ashok Kumar <
> ashok34668@yahoo.com.invalid> wrote:
>
>> Hi,
>>
>> What is the equivalent of this in Spark please
>>
>> select * from mytable where column1 in (select max(column1) from mytable)
>>
>> Thanks
>>
>
>
>
> --
> Best Regards,
> Ayan Guha
>

Re: select * from mytable where column1 in (select max(column1) from mytable)

Posted by ayan guha <gu...@gmail.com>.
Why is this not working for you? Are you trying on dataframe? What error
are you getting?

On Thu, Feb 25, 2016 at 10:23 PM, Ashok Kumar <as...@yahoo.com.invalid>
wrote:

> Hi,
>
> What is the equivalent of this in Spark please
>
> select * from mytable where column1 in (select max(column1) from mytable)
>
> Thanks
>



-- 
Best Regards,
Ayan Guha