Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/16910#discussion_r103630036
--- Diff:
sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveDDLSuite.scala
---
@@ -1587,4 +1588,151 @@ class HiveDDLSuite
}
}
}
+
+ test("insert data to a hive serde table which has a non-existing
location should succeed") {
+ withTable("t") {
+ withTempDir { dir =>
+ spark.sql(
+ s"""
+ |CREATE TABLE t(a string, b int)
+ |USING hive
+ |LOCATION '$dir'
+ """.stripMargin)
+ val table =
spark.sessionState.catalog.getTableMetadata(TableIdentifier("t"))
+ val dirPath = new Path(dir.getAbsolutePath)
+ val fs = dirPath.getFileSystem(spark.sessionState.newHadoopConf())
+ assert(new Path(table.location) == fs.makeQualified(dirPath))
+
+ val tableLocFile = new File(table.location.stripPrefix("file:"))
--- End diff --
`new File(new URI(table.location))`? please avoid `.stripPrefix("file:")`
which looks very hacky.
---
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]