You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by yhuai <gi...@git.apache.org> on 2016/06/01 05:48:31 UTC

[GitHub] spark pull request: [SPARK-15646] [SQL] When spark.sql.hive.convertCTAS is t...

Github user yhuai commented on a diff in the pull request:

    https://github.com/apache/spark/pull/13386#discussion_r65305344
  
    --- Diff: sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveMetastoreCatalog.scala ---
    @@ -447,52 +447,20 @@ private[hive] class HiveMetastoreCatalog(sparkSession: SparkSession) extends Log
           case p: LogicalPlan if p.resolved => p
     
           case p @ CreateTableAsSelectLogicalPlan(table, child, allowExisting) =>
    -        val schema = if (table.schema.nonEmpty) {
    -          table.schema
    +        val desc = if (table.storage.serde.isEmpty) {
    +          // add default serde
    +          table.withNewStorage(
    +            serde = Some("org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe"))
             } else {
    -          child.output.map { a =>
    -            CatalogColumn(a.name, a.dataType.catalogString, a.nullable)
    -          }
    +          table
             }
     
    -        val desc = table.copy(schema = schema)
    -
    -        if (sessionState.convertCTAS && table.storage.serde.isEmpty) {
    -          // Do the conversion when spark.sql.hive.convertCTAS is true and the query
    -          // does not specify any storage format (file format and storage handler).
    -          if (table.identifier.database.isDefined) {
    -            throw new AnalysisException(
    -              "Cannot specify database name in a CTAS statement " +
    -                "when spark.sql.hive.convertCTAS is set to true.")
    --- End diff --
    
    Seems we do support having db name, right?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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