hive 行列转换的函数
时间: 2023-10-24 14:32:32 浏览: 119
HIVE自定义UDF函数
Hive行列转换的函数是LATERAL VIEW。它可以用于将一列的值按照某种规则进行拆分,然后将每个拆分后的值作为一行返回。具体使用时,可以结合explode函数和split函数来实现行列转换的效果。例如,使用LATERAL VIEW explode(split(col, "/")) tbl AS tag,可以将col字段按照"/"进行拆分,然后将拆分后的每个值作为一行返回,并赋值给tag这个别名。这样就实现了行列转换的功能。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [Hive语法详解](https://download.csdn.net/download/thomson617/10952541)[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_1"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [Hive行列转换函数](https://blog.csdn.net/qq_44666176/article/details/121702999)[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_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文