Hi Prem,

You can write like:

  people.where('age >= 10 && 'month === 2).select('name)
  people.where('age >= 10 || 'month === 2).select('name)
  people.where(In('month, Seq(2, 6))).select('name)

The last one needs to import catalyst.expressions package.


Thanks.


2014-07-10 22:15 GMT+09:00 premdass <premdas...@yahoo.co.in>:
> Hi,
>
> any suggestions on how to implement OR clause and IN clause in the SparkSQL
> language integrated queries.
>
> For example:
>
>  'SELECT name FROM people WHERE age >= 10 AND month = 2' can be written as
> val teenagers = people.where('age >= 10).where('month === 2).select('name)
>
> How do we write  'SELECT name FROM people WHERE age >= 10 OR month = 2' ?
>
> Also how do we write  'SELECT name FROM people WHERE month in ( 2,6)' ??
>
> Any suggestions will be greatly appreciated.
>
> Thanks,
> Prem
>
>
>
> --
> View this message in context: 
> http://apache-spark-user-list.1001560.n3.nabble.com/SparkSQL-Language-Integrated-query-OR-clause-and-IN-clause-tp9298.html
> Sent from the Apache Spark User List mailing list archive at Nabble.com.



-- 
Takuya UESHIN
Tokyo, Japan

http://twitter.com/ueshin

Reply via email to