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

    https://github.com/apache/spark/pull/4639#discussion_r24851413
  
    --- Diff: 
sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/SQLQuerySuite.scala 
---
    @@ -42,6 +45,69 @@ class SQLQuerySuite extends QueryTest {
         )
       }
     
    +  test("CTAS without serde") {
    +    def checkRelation(tableName: String, isDataSourceParquet: Boolean): 
Unit = {
    +      val relation = 
EliminateSubQueries(catalog.lookupRelation(Seq(tableName)))
    +      relation match {
    +        case LogicalRelation(r: ParquetRelation2) =>
    +          if (!isDataSourceParquet) {
    +            fail(
    +              s"${classOf[MetastoreRelation].getCanonicalName} is 
expected, but found " +
    +              s"${ParquetRelation2.getClass.getCanonicalName}.")
    +          }
    +
    +        case r: MetastoreRelation =>
    +          if (isDataSourceParquet) {
    +            fail(
    +              s"${ParquetRelation2.getClass.getCanonicalName} is expected, 
but found " +
    +              s"${classOf[MetastoreRelation].getCanonicalName}.")
    +          }
    +      }
    +    }
    +
    +    val originalConf = 
getConf("spark.sql.sources.convertHiveCTASWithoutStorageSpec", "false")
    +
    +    setConf("spark.sql.sources.convertHiveCTASWithoutStorageSpec", "true")
    +
    +    sql("CREATE TABLE ctas1 AS SELECT key k, value FROM src ORDER BY k, 
value")
    +    checkRelation("ctas1", true)
    +    sql("DROP TABLE ctas1")
    +
    +    // Specifying database name for query can be converted to data source 
write path
    +    // is not allowed right now.
    +    val message = intercept[AnalysisException] {
    +      sql("CREATE TABLE default.ctas1 AS SELECT key k, value FROM src 
ORDER BY k, value")
    +    }.getMessage
    +    assert(
    +      message.contains("Cannot specify database name in a CTAS statement"),
    +      "When spark.sql.sources.convertHiveCTASWithoutStorageSpec is true, 
we should not allow " +
    --- End diff --
    
    this message is out of date.  Also, "should.." -> "do not currently allow 
the database name to be specified"


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

Reply via email to