Github user cloud-fan commented on a diff in the pull request: https://github.com/apache/spark/pull/14207#discussion_r71470616 --- Diff: sql/core/src/test/scala/org/apache/spark/sql/execution/command/DDLSuite.scala --- @@ -252,6 +252,165 @@ class DDLSuite extends QueryTest with SharedSQLContext with BeforeAndAfterEach { } } + test("Create partitioned data source table with partitioning columns but no schema") { + import testImplicits._ + + withTempPath { dir => + val pathToPartitionedTable = new File(dir, "partitioned") + val df = sparkContext.parallelize(1 to 10).map(i => (i, i.toString)).toDF("num", "str") + df.write.format("parquet").partitionBy("num").save(pathToPartitionedTable.getCanonicalPath) + val tabName = "tab1" + withTable(tabName) { + spark.sql( + s""" + |CREATE TABLE $tabName + |USING parquet + |OPTIONS ( + | path '$pathToPartitionedTable' + |) + |PARTITIONED BY (inexistentColumns) + """.stripMargin) + val tableMetadata = spark.sessionState.catalog.getTableMetadata(TableIdentifier(tabName)) --- End diff -- we can abstract common logic into some methods, to remove duplicated code a bit.
--- 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