spark-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Reynold Xin <r...@databricks.com>
Subject Re: [question] Why Spark SQL grammar allows <column name> : <data type> ?
Date Fri, 30 Sep 2016 02:24:14 GMT
Is there any harm in supporting it? Mostly curious whether we really need
to "fix" this.



On Thu, Sep 29, 2016 at 7:22 PM, Herman van Hövell tot Westerflier <
hvanhovell@databricks.com> wrote:

> Tejas,
>
> This is because we use the same rule to parse top level and nested data
> fields. For example:
>
> create table tbl_x(
>   id bigint,
>   nested struct<col1:string,col2:string>
> )
>
> Shows both syntaxes. We should split this rule in a top-level and nested
> rule.
>
> Could you open a ticket?
>
> Thanks,
> Herman
>
>
>
> On Thu, Sep 29, 2016 at 6:54 PM, Tejas Patil <tejas.patil.cs@gmail.com>
> wrote:
>
>> Is there any reason why Spark SQL supports "<column name>" ":" "<data
>> type>" while specifying columns ? eg. sql("CREATE TABLE t1 (column1:INT)")
>> works fine.
>>
>> Here is relevant snippet in the grammar [0]:
>>
>> ```
>> colType
>>     : identifier ':'? dataType (COMMENT STRING)?
>>     ;
>> ```
>>
>> I do not see MySQL[1], Hive[2], Presto[3] and PostgreSQL [4] supporting
>> ":" while specifying columns. They all use space as a delimiter.
>>
>> [0] : https://github.com/apache/spark/blob/master/sql/catalyst/
>> src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4#L596
>> [1] : http://dev.mysql.com/doc/refman/5.7/en/create-table.html
>> [2] : https://cwiki.apache.org/confluence/display/Hive/LanguageMan
>> ual+DDL#LanguageManualDDL-CreateTable
>> [3] : https://prestodb.io/docs/current/sql/create-table.html
>> [4] : https://www.postgresql.org/docs/9.1/static/sql-createtable.html
>>
>> Thanks,
>> Tejas
>>
>>
>

Mime
View raw message