rdblue commented on a change in pull request #24617: [SPARK-27732][SQL] Add v2
CreateTable implementation.
URL: https://github.com/apache/spark/pull/24617#discussion_r287000520
##########
File path:
sql/core/src/test/scala/org/apache/spark/sql/execution/command/PlanResolutionSuite.scala
##########
@@ -295,6 +295,84 @@ class PlanResolutionSuite extends AnalysisTest {
}
}
+ test("Test v2 CreateTable with known catalog in identifier") {
+ val sql =
+ s"""
+ |CREATE TABLE IF NOT EXISTS testcat.mydb.table_name (
+ | id bigint,
+ | description string,
+ | point struct<x: double, y: double>)
+ |USING parquet
+ |COMMENT 'table comment'
+ |TBLPROPERTIES ('p1'='v1', 'p2'='v2')
+ |OPTIONS (path 's3://bucket/path/to/data', other 20)
+ """.stripMargin
+
+ val expectedProperties = Map(
+ "p1" -> "v1",
+ "p2" -> "v2",
+ "other" -> "20",
+ "provider" -> "parquet",
+ "location" -> "s3://bucket/path/to/data",
+ "comment" -> "table comment")
+
+ parseAndResolve(sql) match {
+ case create: CreateV2Table =>
+ assert(create.catalog.name == "testcat")
+ assert(create.tableName == Identifier.of(Array("mydb"), "table_name"))
+ assert(create.tableSchema == new StructType()
+ .add("id", LongType)
+ .add("description", StringType)
+ .add("point", new StructType().add("x", DoubleType).add("y",
DoubleType)))
+ assert(create.partitioning.isEmpty)
+ assert(create.properties == expectedProperties)
+ assert(create.ignoreIfExists)
+
+ case other =>
+ fail(s"Expected to parse ${classOf[CreateV2Table].getName} from
query," +
+ s"got ${other.getClass.getName}: $sql")
+ }
+ }
+
+ // TODO(rblue): enable this test after the default catalog is available
Review comment:
I'll update it.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]