Difference between hadoop fs -put and hadoop fs -copyFromLocal

前端 未结 5 366
一个人的身影
一个人的身影 2020-12-02 15:26

-put and -copyFromLocal are documented as identical, while most examples use the verbose variant -copyFromLocal. Why?

Same thing for

5条回答
  •  天命终不由人
    2020-12-02 16:03

    Despite what is claimed by the documentation, as of now (Oct. 2015), both -copyFromLocal and -put are the same.

    From the online help:

    [cloudera@quickstart ~]$ hdfs dfs -help copyFromLocal 
    -copyFromLocal [-f] [-p] [-l]  ...  :
      Identical to the -put command.
    

    And this is confirmed by looking at the sources, where you can see that the CopyFromLocal class extends the Put class, but without adding any new behavior:

      public static class CopyFromLocal extends Put {
        public static final String NAME = "copyFromLocal";
        public static final String USAGE = Put.USAGE;
        public static final String DESCRIPTION = "Identical to the -put command.";
      }
    
      public static class CopyToLocal extends Get {
        public static final String NAME = "copyToLocal";
        public static final String USAGE = Get.USAGE;
        public static final String DESCRIPTION = "Identical to the -get command.";
      }
    

    As you might notice it, this is exactly the same for get/copyToLocal.

提交回复
热议问题