Github user yjshen commented on a diff in the pull request:
https://github.com/apache/spark/pull/8132#discussion_r36950026
--- Diff:
sql/hive/src/test/scala/org/apache/spark/sql/sources/hadoopFsRelationSuites.scala
---
@@ -554,6 +556,21 @@ abstract class HadoopFsRelationTest extends QueryTest
with SQLTestUtils {
clonedConf.foreach(entry => configuration.set(entry.getKey,
entry.getValue))
}
}
+
+ test("SPARK-8887: Explicitly define which data types can be used as
dynamic partition columns") {
+ val df = Seq(
+ (1, "v1", Date.valueOf("2015-08-10")),
+ (2, "v2", Date.valueOf("2015-08-11")),
+ (3, "v3", Date.valueOf("2015-08-12"))).toDF("a", "b", "c")
+ withTempDir { file =>
+ intercept[AnalysisException] {
+
df.write.format(dataSourceName).partitionBy("c").save(file.getCanonicalPath)
+ }
+ }
+ intercept[AnalysisException] {
+ df.write.format(dataSourceName).partitionBy("c").saveAsTable("t")
+ }
--- End diff --
I didn't wrap this into withTable("t") because the saveAsTable will fail
here, and if wrapped in withTable,
`org.apache.spark.sql.catalyst.analysis.NoSuchTableException was thrown.`
```
def getTable(dbName: String, tableName: String): HiveTable = {
getTableOption(dbName, tableName).getOrElse(throw new
NoSuchTableException)
}
```
---
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]