日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

请问:hive中avg聚合函数会使用到combiner功能吗?

發(fā)布時(shí)間:2025/7/25 编程问答 21 豆豆
生活随笔 收集整理的這篇文章主要介紹了 请问:hive中avg聚合函数会使用到combiner功能吗? 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.


例如下面這條SQL, 肯定是用上了combiner功能的


select deptno, sum(sal) as sum_sal from emp group by deptno


hive (test)> explain select deptno, sum(sal) as sum_sal from emp group by deptno; OK Explain STAGE DEPENDENCIES:Stage-1 is a root stageStage-0 depends on stages: Stage-1STAGE PLANS:Stage: Stage-1Map ReduceMap Operator Tree:TableScanalias: empStatistics: Num rows: 5 Data size: 603 Basic stats: COMPLETE Column stats: NONESelect Operatorexpressions: deptno (type: int), sal (type: decimal(22,2))outputColumnNames: deptno, salStatistics: Num rows: 5 Data size: 603 Basic stats: COMPLETE Column stats: NONEGroup By Operatoraggregations: sum(sal)keys: deptno (type: int)mode: hashoutputColumnNames: _col0, _col1Statistics: Num rows: 5 Data size: 603 Basic stats: COMPLETE Column stats: NONEReduce Output Operatorkey expressions: _col0 (type: int)sort order: +Map-reduce partition columns: _col0 (type: int)Statistics: Num rows: 5 Data size: 603 Basic stats: COMPLETE Column stats: NONEvalue expressions: _col1 (type: decimal(32,2))Reduce Operator Tree:Group By Operatoraggregations: sum(VALUE._col0)keys: KEY._col0 (type: int)mode: mergepartialoutputColumnNames: _col0, _col1Statistics: Num rows: 2 Data size: 241 Basic stats: COMPLETE Column stats: NONEFile Output Operatorcompressed: falseStatistics: Num rows: 2 Data size: 241 Basic stats: COMPLETE Column stats: NONEtable:input format: org.apache.hadoop.mapred.SequenceFileInputFormatoutput format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormatserde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDeStage: Stage-0Fetch Operatorlimit: -1Processor Tree:ListSink

如果是這個(gè)SQL,是否能用上combiner功能?? 之前學(xué)習(xí)的時(shí)候說(shuō)combiner不能處理avg這種函數(shù)的


select deptno, avg(sal) as avg_sal from emp group by deptno
我看執(zhí)行計(jì)劃和使用sum聚合函數(shù)無(wú)差異


hive (test)> explain select deptno, avg(sal) as avg_sal from emp group by deptno; OK Explain STAGE DEPENDENCIES:Stage-1 is a root stageStage-0 depends on stages: Stage-1STAGE PLANS:Stage: Stage-1Map ReduceMap Operator Tree:TableScanalias: empStatistics: Num rows: 5 Data size: 603 Basic stats: COMPLETE Column stats: NONESelect Operatorexpressions: deptno (type: int), sal (type: decimal(22,2))outputColumnNames: deptno, salStatistics: Num rows: 5 Data size: 603 Basic stats: COMPLETE Column stats: NONEGroup By Operatoraggregations: avg(sal)keys: deptno (type: int)mode: hashoutputColumnNames: _col0, _col1Statistics: Num rows: 5 Data size: 603 Basic stats: COMPLETE Column stats: NONEReduce Output Operatorkey expressions: _col0 (type: int)sort order: +Map-reduce partition columns: _col0 (type: int)Statistics: Num rows: 5 Data size: 603 Basic stats: COMPLETE Column stats: NONEvalue expressions: _col1 (type: struct<count:bigint,sum:decimal(32,2),input:decimal(22,2)>)Reduce Operator Tree:Group By Operatoraggregations: avg(VALUE._col0)keys: KEY._col0 (type: int)mode: mergepartialoutputColumnNames: _col0, _col1Statistics: Num rows: 2 Data size: 241 Basic stats: COMPLETE Column stats: NONEFile Output Operatorcompressed: falseStatistics: Num rows: 2 Data size: 241 Basic stats: COMPLETE Column stats: NONEtable:input format: org.apache.hadoop.mapred.SequenceFileInputFormatoutput format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormatserde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDeStage: Stage-0Fetch Operatorlimit: -1Processor Tree:ListSink




總結(jié)

以上是生活随笔為你收集整理的请问:hive中avg聚合函数会使用到combiner功能吗?的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。