GitHub user navis opened a pull request:

    https://github.com/apache/spark/pull/8390

    [SPARK-9685] [SQL] Unspported dataType: char(X) in Hive

    I'm getting the following error when I try to read a Hive table with 
char(X) fields:
    
    {code}
    15/08/06 11:38:51 INFO parse.ParseDriver: Parse Completed
    org.apache.spark.sql.types.DataTypeException: Unsupported dataType: 
char(8). If you have a struct and a field name of it has any special 
characters, please use backticks (`) to quote that field name, e.g. `x+y`. 
Please note that backtick itself is not supported in a field name.
            at 
org.apache.spark.sql.types.DataTypeParser$class.toDataType(DataTypeParser.scala:95)
            at 
org.apache.spark.sql.types.DataTypeParser$$anon$1.toDataType(DataTypeParser.scala:107)
            at 
org.apache.spark.sql.types.DataTypeParser$.parse(DataTypeParser.scala:111)
            at 
org.apache.spark.sql.hive.HiveMetastoreTypes$.toDataType(HiveMetastoreCatalog.scala:769)
            at 
org.apache.spark.sql.hive.MetastoreRelation$SchemaAttribute.toAttribute(HiveMetastoreCatalog.scala:742)
            at 
org.apache.spark.sql.hive.MetastoreRelation$$anonfun$44.apply(HiveMetastoreCatalog.scala:752)
            at 
org.apache.spark.sql.hive.MetastoreRelation$$anonfun$44.apply(HiveMetastoreCatalog.scala:752)
    {code}
    
    It seems there is no "char" DataType defined in the DataTypeParser class
    {code}
      protected lazy val primitiveType: Parser[DataType] =
        "(?i)string".r ^^^ StringType |
        "(?i)float".r ^^^ FloatType |
        "(?i)(?:int|integer)".r ^^^ IntegerType |
        "(?i)tinyint".r ^^^ ByteType |
        "(?i)smallint".r ^^^ ShortType |
        "(?i)double".r ^^^ DoubleType |
        "(?i)(?:bigint|long)".r ^^^ LongType |
        "(?i)binary".r ^^^ BinaryType |
        "(?i)boolean".r ^^^ BooleanType |
        fixedDecimalType |
        "(?i)decimal".r ^^^ DecimalType.USER_DEFAULT |
        "(?i)date".r ^^^ DateType |
        "(?i)timestamp".r ^^^ TimestampType |
        varchar
    {code}


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

    $ git pull https://github.com/navis/spark SPARK-9685

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

    https://github.com/apache/spark/pull/8390.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 #8390
    
----
commit 836d5ff60be8502a99395adda6d9ce53e94c31cc
Author: navis.ryu <na...@apache.org>
Date:   2015-08-24T06:15:40Z

    [SPARK-9685] [SQL] Unspported dataType: char(X) in Hive

----


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

Reply via email to