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

    https://github.com/apache/spark/pull/16587#discussion_r96155690
  
    --- Diff: 
sql/core/src/test/scala/org/apache/spark/sql/execution/command/DDLSuite.scala 
---
    @@ -1692,20 +1678,27 @@ class DDLSuite extends QueryTest with 
SharedSQLContext with BeforeAndAfterEach {
     
       test("truncate table - external table, temporary table, view (not 
allowed)") {
         import testImplicits._
    -    val path = Utils.createTempDir().getAbsolutePath
    -    (1 to 10).map { i => (i, i) }.toDF("a", 
"b").createTempView("my_temp_tab")
    -    sql(s"CREATE EXTERNAL TABLE my_ext_tab LOCATION '$path'")
    -    sql(s"CREATE VIEW my_view AS SELECT 1")
    -    intercept[NoSuchTableException] {
    -      sql("TRUNCATE TABLE my_temp_tab")
    +    withTempPath { tempDir =>
    +      withTable("my_ext_tab") {
    +        (("a", "b") :: Nil).toDF().write.parquet(tempDir.getCanonicalPath)
    +        (1 to 10).map { i => (i, i) }.toDF("a", 
"b").createTempView("my_temp_tab")
    +        sql(s"CREATE TABLE my_ext_tab using parquet LOCATION '$tempDir'")
    --- End diff --
    
    Ah, this is why you asked me 
https://github.com/apache/spark/pull/16586#discussion_r96142347. I just ran a 
test for this to help.
    
    ```
     - truncate table - external table, temporary table, view (not allowed) *** 
FAILED *** (188 milliseconds)
       org.apache.spark.sql.AnalysisException: Path does not exist: 
file:/C:projectsspark       arget   
mpspark-9e70280d-56dc-4063-8f40-8e62fec18394;
       at 
org.apache.spark.sql.execution.datasources.DataSource$$anonfun$14.apply(DataSource.scala:382)
       at 
org.apache.spark.sql.execution.datasources.DataSource$$anonfun$14.apply(DataSource.scala:370)
       at 
scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:241)
       at 
scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:241)
    ```
    
     Maybe, it'd be okay to just use `toURI` if this test is not supposed to 
test Windows path..


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

Reply via email to