[GitHub] spark issue #10706: [SPARK-12543] [SPARK-4226] [SQL] Subquery in expression

2016-06-12 Thread hvanhovell
Github user hvanhovell commented on the issue:

https://github.com/apache/spark/pull/10706
  
@kamalcoursera you could use a predicate scalar subquery here, i.e.:
```sql
select   runon as runon
 case
  when (select max(true) from sqltesttable b where b.key = a.key 
and group = 'vowels') then 'vowels'
  else 'consonants'
 end as group,
 key as key,
 someint as someint
from sqltesttable a;
```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark issue #10706: [SPARK-12543] [SPARK-4226] [SQL] Subquery in expression

2016-06-12 Thread kamalcoursera
Github user kamalcoursera commented on the issue:

https://github.com/apache/spark/pull/10706
  
Thank you ! Any alternative options to use instead of predicate subquery ? 
Is it in plan for amendment in 2.0?

Select 
runon as runon,
case 
when key in (Select key from sqltesttable where group = 'vowels') then 
'vowels'
else 'consonants'
end as group,
key as key,
someint as someint
from sqltesttable;


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark issue #10706: [SPARK-12543] [SPARK-4226] [SQL] Subquery in expression

2016-06-08 Thread davies
Github user davies commented on the issue:

https://github.com/apache/spark/pull/10706
  
predicate subquery (IN, EXISTS) in SELECT is not supported in 2.0, only 
supported in WHERE/HAVING.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark issue #10706: [SPARK-12543] [SPARK-4226] [SQL] Subquery in expression

2016-06-07 Thread kamalcoursera
Github user kamalcoursera commented on the issue:

https://github.com/apache/spark/pull/10706
  
Hi Davies,

Could you please shed more light on the status of correlated but non-scalar 
subquery in Spark 2.0 release. Appreciate if you can summarize any other 
restrictions, if any.


**Query:**

Select 
runon as runon,  
case 
 when key in (Select key from sqltesttable where group = 'vowels') then 
'vowels'
  else 'consonants'
end as group,
key as key,
someint as someint  
from sqltesttable;

**Error:**

Error in SQL statement: AnalysisException: Predicate sub-queries can only 
be used in a Filter: Project [runon#4031 AS runon#4026,CASE WHEN 
predicate-subquery#4027 [(key#4033 = key#4037)] THEN vowels ELSE consonants END 
AS group#4028,key#4033 AS key#4029,someint#4034 AS someint#4030]
:  +- SubqueryAlias predicate-subquery#4027 [(key#4033 = key#4037)]
: +- Project [key#4037]
:+- Filter (group#4036 = vowels)
:   +- MetastoreRelation default, sqltesttable, None
+- MetastoreRelation default, sqltesttable, None
;


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org