本文介绍了getCacheFiles()和getLocalCacheFiles()是一样的吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如已被弃用,我试图找到一个替代方案。 似乎是一个,但我怀疑它们是否相同。

当您调用,HDFS中的文件将被下载到每个节点并使用 getLocalCacheFiles()本地化文件路径,并且可以从本地文件系统读取它。但是, getCacheFiles()返回的是HDFS中文件的URI。如果你通过这个URI读取文件,我怀疑你仍然从HDFS读取而不是本地文件系统。



以上是我的理解,我不知道它是否是正确。如果是这样, getLocalCacheFiles()的替代选择是什么?为什么Hadoop首先不赞成它?

解决方案

它是开源的。你总是可以找到引入 @Deprectated 的git blame:commit ,它用于。在JIRA的尾部,你会发现这个讨论:

所以你应该打开文件,它会在那里。没有专门的API。


As getLocalCacheFiles() is deprecated, I'm trying to find an alternative. getCacheFiles() seems to be one, but I doubt whether they are the same.

When you call addCacheFile(), the file in HDFS would be downloaded to every node and using getLocalCacheFiles() you can get the localized file path and you can read it from local file system. However, what getCacheFiles() returns is the URI of the file in HDFS. If you read file by this URI, I doubt that you still read from HDFS instead of local file system.

The above is my understanding, I don't know whether it's correct. If so, what's the alternative for getLocalCacheFiles()? And why Hadoop deprecate it in the first place?

解决方案

It's open source. You can always find the git blame that introduced the @Deprectated: commit 735b50e8bd23f7fbeff3a08cf8f3fff8cbff7449, which is for MAPREDUCE-4493. At the tail of the JIRA you'll find this discussion:

So you're supposed to just open the file, it will be there. No dedicated API.

这篇关于getCacheFiles()和getLocalCacheFiles()是一样的吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 20:01