hive的分桶抽样查询
时间: 2023-09-12 08:11:32 浏览: 97
Hive 分桶
5星 · 资源好评率100%
Hive的分桶抽样查询是通过对分桶字段的值进行哈希运算,然后除以桶的个数求余的方式决定该条记录存放在哪个桶当中,从而实现对分桶数据的抽样查询。要进行分桶抽样查询,可以使用以下语句:select * from tablename tablesample(bucket x out of y);其中x表示选择的桶数,y表示总共的桶数。在进行分桶抽样查询之前,需要设置hive.enforce.bucketing=true,以确保分桶功能生效。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [Hive 查询之分桶及抽样查询](https://blog.csdn.net/m0_37294838/article/details/89817783)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *2* [Hive 分桶及抽样查询](https://blog.csdn.net/qq_39327985/article/details/89002533)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文