GitHub user watermen opened a pull request:

    https://github.com/apache/incubator-carbondata/pull/618

    [CARBONDATA-734] Support the syntax of 'STORED BY PARQUET/ORC'

    When I create parquet table with the command below:
    ```shell
    import org.apache.spark.sql.SparkSession 
    import org.apache.spark.sql.CarbonSession._
    val carbon = 
SparkSession.builder().config(sc.getConf).getOrCreateCarbonSession("hdfs://100.0.0.4:9000/user/hive/warehouse/carbon.store")
    carbon.sql("create table src(key int, value string) stored as parquet")
    ```
    
    It will failed with the error info below:
    ```shell
    java.lang.RuntimeException: [1.1] failure: identifier matching regex 
(?i)ALTER expected
    
    create table src(key int, value string) stored as parquet
    ^
      at scala.sys.package$.error(package.scala:27)
      at 
org.apache.spark.sql.parser.CarbonSpark2SqlParser.parse(CarbonSpark2SqlParser.scala:45)
      at 
org.apache.spark.sql.parser.CarbonSparkSqlParser.parsePlan(CarbonSparkSqlParser.scala:51)
      at org.apache.spark.sql.SparkSession.sql(SparkSession.scala:592)
      ... 50 elided
    ```
    
    The reason is if we use `STORED AS`, the value of 
`value.storageHandler().STRING()` will be null, so if we still invoke 
`STRING()`, it will be throw exception.
    
    cc @jackylk 

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/watermen/incubator-carbondata CARBONDATA-734

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-carbondata/pull/618.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #618
    
----
commit e63ea4b4de08849a9041463584913d189e96b79a
Author: Yadong Qi <qiyadong2...@gmail.com>
Date:   2017-03-01T07:26:15Z

    Support the syntax of 'STORED BY PARQUET/ORC'.

----


---
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.
---

Reply via email to