[ 
https://issues.apache.org/jira/browse/SPARK-17253?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15458033#comment-15458033
 ] 

Herman van Hovell commented on SPARK-17253:
-------------------------------------------

[~jiangxb] We do support cross join.

This is a duplicate of SPARK-17296.

> Left join where ON clause does not reference the right table produces 
> analysis error
> ------------------------------------------------------------------------------------
>
>                 Key: SPARK-17253
>                 URL: https://issues.apache.org/jira/browse/SPARK-17253
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 2.0.0
>            Reporter: Josh Rosen
>            Priority: Minor
>
> The following query produces an AnalysisException:
> {code}
> CREATE TABLE currency (
>  cur CHAR(3)
> );
> CREATE TABLE exchange (
>  cur1 CHAR(3),
>  cur2 CHAR(3),
>  rate double
> );
> INSERT INTO currency VALUES ('EUR');
> INSERT INTO currency VALUES ('GBP');
> INSERT INTO currency VALUES ('USD');
> INSERT INTO exchange VALUES ('EUR', 'GBP', 0.85);
> INSERT INTO exchange VALUES ('GBP', 'EUR', 1.0/0.85);
> SELECT c1.cur cur1, c2.cur cur2, COALESCE(self.rate, x.rate) rate
> FROM currency c1
> CROSS JOIN currency c2
> LEFT JOIN exchange x
>    ON x.cur1=c1.cur
>    AND x.cur2=c2.cur
> LEFT JOIN (SELECT 1 rate) self
>    ON c1.cur=c2.cur;
> {code}
> {code}
> AnalysisException: cannot resolve '`c1.cur`' given input columns: [cur, cur1, 
> cur2, rate]; line 5 pos 13
> {code}
> However, this query is runnable in sqlite3 and postgres. This example query 
> was adapted from https://www.sqlite.org/src/tktview?name=ebdbadade5, a sqlite 
> bug report in which this query gave a wrong answer.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to