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

    https://github.com/apache/spark/pull/17505#discussion_r109851825
  
    --- Diff: 
sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveClientImpl.scala 
---
    @@ -694,12 +694,25 @@ private[hive] class HiveClientImpl(
           tableName: String,
           replace: Boolean,
           isSrcLocal: Boolean): Unit = withHiveState {
    -    shim.loadTable(
    -      client,
    -      new Path(loadPath),
    -      tableName,
    -      replace,
    -      isSrcLocal)
    +    val tbl = client.getTable(tableName)
    +    val fs = tbl.getDataLocation.getFileSystem(conf)
    +    if (replace) {
    --- End diff --
    
    `replaceFiles` will move files one by one, so it will take a long time if 
load many output files, as follows:
    ```
    17/04/01 10:50:04 INFO TaskSetManager: Finished task 216432.0 in stage 0.0 
(TID 216866) in 3022 ms on jqhadoop-test28-52.int.yihaodian.com (executor 87) 
(216868/216869)
    17/04/01 10:50:04 INFO TaskSetManager: Finished task 207165.0 in stage 0.0 
(TID 216796) in 5952 ms on jqhadoop-test28-8.int.yihaodian.com (executor 54) 
(216869/216869)
    17/04/01 10:50:04 INFO YarnScheduler: Removed TaskSet 0.0, whose tasks have 
all completed, from pool 
    17/04/01 10:50:04 INFO DAGScheduler: ResultStage 0 (processCmd at 
CliDriver.java:376) finished in 541.797 s
    17/04/01 10:50:04 INFO DAGScheduler: Job 0 finished: processCmd at 
CliDriver.java:376, took 551.208919 s
    17/04/01 10:50:04 INFO FileFormatWriter: Job null committed.
    17/04/01 10:50:14 INFO Hive: Replacing 
src:viewfs://cluster4/user/hive/warehouse/staging/.hive-staging_hive_2017-04-01_10-40-02_349_8047899863313770218-1/-ext-10000/part-00000-9335c5f3-60fa-418b-a466-2d76a5e84537-c000,
 dest: 
viewfs://cluster4/user/hive/warehouse/tmp.db/spark_load_slow/part-00000-9335c5f3-60fa-418b-a466-2d76a5e84537-c000,
 Status:true
    17/04/01 10:50:14 INFO Hive: Replacing 
src:viewfs://cluster4/user/hive/warehouse/staging/.hive-staging_hive_2017-04-01_10-40-02_349_8047899863313770218-1/-ext-10000/part-00001-9335c5f3-60fa-418b-a466-2d76a5e84537-c000,
 dest: 
viewfs://cluster4/user/hive/warehouse/tmp.db/spark_load_slow/part-00001-9335c5f3-60fa-418b-a466-2d76a5e84537-c000,
 Status:true
    17/04/01 10:50:14 INFO Hive: Replacing 
src:viewfs://cluster4/user/hive/warehouse/staging/.hive-staging_hive_2017-04-01_10-40-02_349_8047899863313770218-1/-ext-10000/part-00002-9335c5f3-60fa-418b-a466-2d76a5e84537-c000,
 dest: 
viewfs://cluster4/user/hive/warehouse/tmp.db/spark_load_slow/part-00002-9335c5f3-60fa-418b-a466-2d76a5e84537-c000,
 Status:true
    17/04/01 10:50:14 INFO Hive: Replacing 
src:viewfs://cluster4/user/hive/warehouse/staging/.hive-staging_hive_2017-04-01_10-40-02_349_8047899863313770218-1/-ext-10000/part-00003-9335c5f3-60fa-418b-a466-2d76a5e84537-c000,
 dest: 
viewfs://cluster4/user/hive/warehouse/tmp.db/spark_load_slow/part-00003-9335c5f3-60fa-418b-a466-2d76a5e84537-c000,
 Status:true
    17/04/01 10:50:14 INFO Hive: Replacing 
src:viewfs://cluster4/user/hive/warehouse/staging/.hive-staging_hive_2017-04-01_10-40-02_349_8047899863313770218-1/-ext-10000/part-00004-9335c5f3-60fa-418b-a466-2d76a5e84537-c000,
 dest: 
viewfs://cluster4/user/hive/warehouse/tmp.db/spark_load_slow/part-00004-9335c5f3-60fa-418b-a466-2d76a5e84537-c000,
 Status:true
    17/04/01 10:50:14 INFO Hive: Replacing 
src:viewfs://cluster4/user/hive/warehouse/staging/.hive-staging_hive_2017-04-01_10-40-02_349_8047899863313770218-1/-ext-10000/part-00005-9335c5f3-60fa-418b-a466-2d76a5e84537-c000,
 dest: 
viewfs://cluster4/user/hive/warehouse/tmp.db/spark_load_slow/part-00005-9335c5f3-60fa-418b-a466-2d76a5e84537-c000,
 Status:true
    17/04/01 10:50:14 INFO Hive: Replacing 
src:viewfs://cluster4/user/hive/warehouse/staging/.hive-staging_hive_2017-04-01_10-40-02_349_8047899863313770218-1/-ext-10000/part-00006-9335c5f3-60fa-418b-a466-2d76a5e84537-c000,
 dest: 
viewfs://cluster4/user/hive/warehouse/tmp.db/spark_load_slow/part-00006-9335c5f3-60fa-418b-a466-2d76a5e84537-c000,
 Status:true
    17/04/01 10:50:14 INFO Hive: Replacing 
src:viewfs://cluster4/user/hive/warehouse/staging/.hive-staging_hive_2017-04-01_10-40-02_349_8047899863313770218-1/-ext-10000/part-00007-9335c5f3-60fa-418b-a466-2d76a5e84537-c000,
 dest: 
viewfs://cluster4/user/hive/warehouse/tmp.db/spark_load_slow/part-00007-9335c5f3-60fa-418b-a466-2d76a5e84537-c000,
 Status:true
    17/04/01 10:50:14 INFO Hive: Replacing 
src:viewfs://cluster4/user/hive/warehouse/staging/.hive-staging_hive_2017-04-01_10-40-02_349_8047899863313770218-1/-ext-10000/part-00008-9335c5f3-60fa-418b-a466-2d76a5e84537-c000,
 dest: 
viewfs://cluster4/user/hive/warehouse/tmp.db/spark_load_slow/part-00008-9335c5f3-60fa-418b-a466-2d76a5e84537-c000,
 Status:true
    
    ...
    
    17/04/01 11:16:11 INFO Hive: Replacing 
src:viewfs://cluster4/user/hive/warehouse/staging/.hive-staging_hive_2017-04-01_10-40-02_349_8047899863313770218-1/-ext-10000/part-99995-9335c5f3-60fa-418b-a466-2d76a5e84537-c000,
 dest: 
viewfs://cluster4/user/hive/warehouse/tmp.db/spark_load_slow/part-99995-9335c5f3-60fa-418b-a466-2d76a5e84537-c000,
 Status:true
    17/04/01 11:16:11 INFO Hive: Replacing 
src:viewfs://cluster4/user/hive/warehouse/staging/.hive-staging_hive_2017-04-01_10-40-02_349_8047899863313770218-1/-ext-10000/part-99996-9335c5f3-60fa-418b-a466-2d76a5e84537-c000,
 dest: 
viewfs://cluster4/user/hive/warehouse/tmp.db/spark_load_slow/part-99996-9335c5f3-60fa-418b-a466-2d76a5e84537-c000,
 Status:true
    17/04/01 11:16:11 INFO Hive: Replacing 
src:viewfs://cluster4/user/hive/warehouse/staging/.hive-staging_hive_2017-04-01_10-40-02_349_8047899863313770218-1/-ext-10000/part-99997-9335c5f3-60fa-418b-a466-2d76a5e84537-c000,
 dest: 
viewfs://cluster4/user/hive/warehouse/tmp.db/spark_load_slow/part-99997-9335c5f3-60fa-418b-a466-2d76a5e84537-c000,
 Status:true
    17/04/01 11:16:11 INFO Hive: Replacing 
src:viewfs://cluster4/user/hive/warehouse/staging/.hive-staging_hive_2017-04-01_10-40-02_349_8047899863313770218-1/-ext-10000/part-99998-9335c5f3-60fa-418b-a466-2d76a5e84537-c000,
 dest: 
viewfs://cluster4/user/hive/warehouse/tmp.db/spark_load_slow/part-99998-9335c5f3-60fa-418b-a466-2d76a5e84537-c000,
 Status:true
    17/04/01 11:16:11 INFO Hive: Replacing 
src:viewfs://cluster4/user/hive/warehouse/staging/.hive-staging_hive_2017-04-01_10-40-02_349_8047899863313770218-1/-ext-10000/part-99999-9335c5f3-60fa-418b-a466-2d76a5e84537-c000,
 dest: 
viewfs://cluster4/user/hive/warehouse/tmp.db/spark_load_slow/part-99999-9335c5f3-60fa-418b-a466-2d76a5e84537-c000,
 Status:true
    17/04/01 11:16:18 INFO SparkSqlParser: Parsing command: 
`tmp`.`spark_load_slow`
    17/04/01 11:16:18 INFO CatalystSqlParser: Parsing command: string
    17/04/01 11:16:18 INFO CatalystSqlParser: Parsing command: string
    17/04/01 11:16:18 INFO CatalystSqlParser: Parsing command: string
    17/04/01 11:16:18 INFO CatalystSqlParser: Parsing command: string
    17/04/01 11:16:18 INFO CatalystSqlParser: Parsing command: string
    Time taken: 2178.736 seconds
    17/04/01 11:16:18 INFO CliDriver: Time taken: 2178.736 seconds
    ```
    `moveFile` only move once.
    
    Full log can be find 
[spark.loadTable.log.tar.gz](https://issues.apache.org/jira/secure/attachment/12861612/spark.loadTable.log.tar.gz),
 [SPARK-20187](https://issues.apache.org/jira/browse/SPARK-20187).


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

Reply via email to