Github user ericl commented on a diff in the pull request:
https://github.com/apache/spark/pull/13386#discussion_r65265388
--- 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 --
Should we keep this restriction?
---
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 [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]