Hadoop将输入数据的内容分成多个块,而与内容无关。
如帖子所述:
HDFS has no idea (and doesn’t care) what’s stored inside the file, so raw files are not split in accordance with rules that we humans would understand. Humans, for example, would want record boundaries — the lines showing where a record begins and ends — to be respected.
我不清楚的部分是,如果仅根据数据大小拆分数据而不考虑内容,那么以后执行的查询的准确性是否没有影响?例如,经常出现的城市和每日温度列表示例。一个城市可能在一个街区中,而其温度却在其他地方,那么 map 操作如何正确查询该信息。我似乎缺少有关块和MR查询的一些基本知识。
任何帮助将不胜感激。
最佳答案
could a city be in one block and its temperature somewhere else
完全有可能,是的。在这种情况下,记录边界跨越两个块,并且都被收集。
准确性不会丢失,但是就磁盘和网络IO而言,性能肯定是可以保证的。当未到达InputSplit的情况下检测到块的末尾时,将读取下一个块。即使此拆分位于下一个块的前几个字节之内,它的字节流仍会被处理。
关于hadoop - Hadoop数据 block 和数据内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47664809/