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

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

【原创】大叔经验分享(33)hive select count为0

發布時間:2024/9/5 编程问答 45 豆豆
生活随笔 收集整理的這篇文章主要介紹了 【原创】大叔经验分享(33)hive select count为0 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

hive建表后直接將數據文件拷貝到table目錄下,select * 可以查到數據,但是select count(1) 一直返回0,這個是因為hive中有個配置

hive.stats.autogather=true

Enables automated gathering of table-level statistics for newly created tables and table partitions, such as tables created with the INSERT OVERWRITE statement. The parameter does not produce column-level statistics, such as those generated by CBO. If disabled, administrators must manually generate the table-level statistics for newly generated tables and table partitions with the ANALYZE TABLE statement.

可以通過describe來查看table的統計信息

DESCRIBE EXTENDED $table_name;

有個配置控制是否使用talbe的統計信息

hive.compute.query.using.stats=true

Instructs Hive to use statistics when generating query plans

很多人建議的處理方法是

set hive.compute.query.using.stats=false;

正解應該是

ANALYZE TABLE $table_name COMPUTE STATISTICS;

ANALYZE TABLE $table_name partition(p=$1) COMPUTE STATISTICS;

即重新計算統計信息


參考:https://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.6.5/bk_hive-performance-tuning/content/ch_cost-based-optimizer.html

轉載于:https://www.cnblogs.com/barneywill/p/10431323.html

與50位技術專家面對面20年技術見證,附贈技術全景圖

總結

以上是生活随笔為你收集整理的【原创】大叔经验分享(33)hive select count为0的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。