为什么hive中的fetch任务比map-only任务工作得更快?

fae0ux8s  于 2021-06-02  发布在  Hadoop
关注(0)|答案(1)|浏览(329)

可以在配置单元中为简单查询启用fetch任务,而不是使用配置单元的map或mapreduce hive.fetch.task.conversion 参数。
请解释为什么fetch任务比map运行得快,特别是在做一些简单的工作时(例如 select * from table limit 10; )? 在这种情况下,只Map的任务在做什么?在我的例子中,性能差异快了20多倍。两个任务都应该读取表数据,不是吗?

72qzrwbm

72qzrwbm1#

fetchtask直接获取数据,而mapreduce将调用mapreduce作业

<property>
  <name>hive.fetch.task.conversion</name>
  <value>minimal</value>
  <description>
    Some select queries can be converted to single FETCH task 
    minimizing latency.Currently the query should be single 
    sourced not having any subquery and should not have
    any aggregations or distincts (which incurrs RS), 
    lateral views and joins.
    1. minimal : SELECT STAR, FILTER on partition columns, LIMIT only
    2. more    : SELECT, FILTER, LIMIT only (+TABLESAMPLE, virtual columns)
  </description>
</property>

还有另一个参数 hive.fetch.task.conversion.threshold 0.10-0.13中的默认值是-1,>0.14是1g(1073741824),这表示如果表大小大于1g,则使用mapreduce而不是fetch task
更多细节

相关问题