You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Liang-Chi Hsieh (JIRA)" <ji...@apache.org> on 2018/01/26 08:55:00 UTC

[jira] [Commented] (SPARK-23224) union all will throw gramma exception

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

Liang-Chi Hsieh commented on SPARK-23224:
-----------------------------------------

[https://cwiki.apache.org/confluence/display/Hive/LanguageManual+Union#LanguageManualUnion-ApplyingSubclauses]

The rule is similar as Hive. You can place the clause inside one pair of parentheses that enclose the SELECT.
{code:java}

insert overwrite table tmp_wjmdb.tmp_cyk_test1
(select * from tmp_wjmdb.abctest limit 10)
union all
(select * from tmp_wjmdb.abctest limit 20);{code}

> union all will throw gramma exception
> -------------------------------------
>
>                 Key: SPARK-23224
>                 URL: https://issues.apache.org/jira/browse/SPARK-23224
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 2.2.0
>            Reporter: chenyukang
>            Priority: Major
>
> when keyword "limit " in first sub query , this query will fail with gramma exception
> {code:java}
> spark-sql>
>          >
>          > insert overwrite table tmp_wjmdb.tmp_cyk_test1
>          > select * from tmp_wjmdb.abctest limit 10
>          > union all
>          > select * from tmp_wjmdb.abctest limit 20;
> 18/01/26 12:18:58 INFO SparkSqlParser: Parsing command: insert overwrite table tmp_wjmdb.tmp_cyk_test1
> select * from tmp_wjmdb.abctest limit 10
> union all
> select * from tmp_wjmdb.abctest limit 20
> Error in query:
> mismatched input 'union' expecting {<EOF>, '.', '[', 'OR', 'AND', 'IN', NOT, 'BETWEEN', 'LIKE', RLIKE, 'IS', EQ, '<=>', '<>', '!=', '<', LTE, '>', GTE, '+', '-', '*', '/', '%', 'DIV', '&', '|', '^'}(line 3, pos 0)
> == SQL ==
> insert overwrite table tmp_wjmdb.tmp_cyk_test1
> select * from tmp_wjmdb.abctest limit 10
> union all
> ^^^
> select * from tmp_wjmdb.abctest limit 20
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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