beliefer edited a comment on issue #23841: [SPARK-26936][SQL] Fix bug of insert 
overwrite local dir and inconsistent behavior with Hive
URL: https://github.com/apache/spark/pull/23841#issuecomment-467742406
 
 
   I have run these SQL you provided on local[*] deploy mode and still appear 
inconsistent behavior too.
   The spark version to test is 2.3.0.
   ```
   ls /tmp/noexistdir
   ls: cannot access /tmp/noexistdir: No such file or directory
   
   scala> sql("""create table t(c0 int, c1 int)""")
   res0: org.apache.spark.sql.DataFrame = []
   scala> spark.table("t").explain
   == Physical Plan ==
   HiveTableScan [c0#5, c1#6], HiveTableRelation `default`.`t`, 
org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe, [c0#5, c1#6]
   
   scala> sql("""insert into t values(1, 1)""")
   scala> sql("""select * from t""").show
   +---+---+                                                                    
   
   | c0| c1|
   +---+---+
   |  1|  1|
   +---+---+
   
   scala> sql("""insert overwrite local directory '/tmp/noexistdir/t' select * 
from t""")
   res1: org.apache.spark.sql.DataFrame = [] 
   
   ls /tmp/noexistdir/t/
   /tmp/noexistdir/t
   
   vi /tmp/noexistdir/t
     1 
   ```
   '/tmp/noexistdir/t' is not a directory but a file.
   Normally, temp path has result file and '_SUCCESS' file.
   I doubt result file cover the '_SUCCESS' file by code as follows:
   ` fs.listStatus(tmpPath).foreach {
           tmpFile => fs.rename(tmpFile.getPath, writeToPath)
         }`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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]

Reply via email to