Every time I use hadoop fs -ls /path_to_directory or hadoop fs -ls -h /path_to_directory , the result is like the following
drwxr-xr-x - hadoop supergroup 0 2016-08-05 00:22/user/hive-0.13.1/warehouse/t_b_city
drwxr-xr-x - hadoop supergroup 0 2016-06-15 16:28/user/hive-0.13.1/warehouse/t_b_mobile
The size of directory inside HDFS is always shown as 0 no matter there is file wihin it or not.
Browsing from the web UI gives the same reuslt as following :
drwxr-xr-x hadoop supergroup 0 B 0 0 B t_b_city
drwxr-xr-x hadoop supergroup 0 B 0 0 B t_b_mobile
However, there are actually files within those directory. When using command hadoop fs -du -h /user/hive-0.13.1/warehouse/ , the directory size can be shown correctly as the following:
385.5 K /user/hive-0.13.1/warehouse/t_b_city
1.1 M /user/hive-0.13.1/warehouse/t_b_mobile
Why would the hadoop fs -ls command of hdfs and the web UI always show 0 for a directory ?
Also, the hadoop fs -ls command usually finish immediately while the hadoop fs -du would take sometime to execute. It seems that the hadoop fs -ls command doesn't actually spend time on calculating total size of a directory.