hive之mapjoin

hive之mapjoin,第1张

hive之mapjoin 一:该如何使其生效
  • set hive.auto.convert.join = true;  --是否开自动mapjoin
  • set hive.mapjoin.smalltable.filesize;   --mapjoin的表size大小

两个同时设置。具体的 filesize 量力而行,默认我记得好像使25m 很多帖子上的奇怪语法你也不用去看,都是老掉牙的东西了,比如:,除非你的hive版本很低,否则根本用不上。

还有一个:set hive.ignore.mapjoin.hint=true; 这个的话我觉得咩有必要。集群本身也是有参数设置的,且运维是有考量的。即使这么干了也不一定就会生效。走常规的方式即可。适当的调整hive.mapjoin.smalltable.filesize 这个值的大小。其实这个本身就是对小表来说的,但是大小是相对的,你如果有一个500g的表和一个50g的小表关联,你放内存真不一定就合适。个人建议1g以下的可以考虑,太大的话就没必要了。

二:hive 的mapjoin起作用了我们如何确定?
  • 只是inner join 的时候

看日志吧,最为直观:

2021-12-10 12:05:41	Starting to launch local task to process map join;	maximum memory = 954728448
2021-12-10 12:05:44	Processing rows:	200000	Hashtable size:	199999	Memory usage:	135058920	percentage:	0.141
2021-12-10 12:05:44	Dump the side-table into file: file:/tmp/hive_2021-12-10_11-47-34_913_2061727660300134431-1/-local-10007/HashTable-Stage-13/MapJoin-mapfile10--.hashtable
2021-12-10 12:05:44	Uploaded 1 File to: file:/tmp/hive_2021-12-10_11-47-34_913_2061727660300134431-1/-local-10007/HashTable-Stage-13/MapJoin-mapfile10--.hashtable (3517 bytes)
2021-12-10 12:05:44	Dump the side-table into file: file:/tmp/hive_2021-12-10_11-47-34_913_2061727660300134431-1/-local-10007/HashTable-Stage-13/MapJoin-mapfile12--.hashtable
2021-12-10 12:05:44	Uploaded 1 File to: file:/tmp/hive_2021-12-10_11-47-34_913_2061727660300134431-1/-local-10007/HashTable-Stage-13/MapJoin-mapfile12--.hashtable (8683158 bytes)
2021-12-10 12:05:44	End of local task; Time Taken: 3.034 sec.
Execution completed successfully

 关键点:

  1. Starting to launch local task to process map join; 这个说的够直白了吧
  2. Uploaded 1 File to: file:/tmp/hive_2021-12-10_11-47-34_913_2061727660300134431-1/-local-10007/HashTable-Stage-13/MapJoin-mapfile10--.hashtable    hashtable 
  3. end of local task  
  4. 起一个local task 映射成一个hashtable 

欢迎分享,转载请注明来源:内存溢出

原文地址: https://www.outofmemory.cn/zaji/5655873.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-16
下一篇 2022-12-16

发表评论

登录后才能评论

评论列表(0条)

保存