hive 列转行 行转列
时间: 2023-10-18 11:27:57 浏览: 116
Hive中的列转行和行转列是通过使用一些特定的内置函数和关键字来实现的。列转行可以使用EXPLODE函数,该函数可以将一个包含复杂结构的数组或者映射拆分成多行。行转列可以使用collect_set函数,该函数将某一列的所有数据转化为一个集合,并且可以使用concat_ws函数将集合中的所有元素以逗号分割连接成一个字符串。此外,为了使用EXPLODE和LATERAL VIEW函数,你可以使用LATERAL VIEW关键字,语法为LATERAL VIEW udtf(expression) tableAlias AS columnAlias。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [hive列转行案例](https://download.csdn.net/download/weixin_38581777/14037437)[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: 33.333333333333336%"]
- *2* [hive行转列与列转行](https://blog.csdn.net/qq_24790473/article/details/109710145)[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: 33.333333333333336%"]
- *3* [hive操作(行转列,列转行)](https://blog.csdn.net/aiduo3346/article/details/102085019)[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: 33.333333333333336%"]
[ .reference_list ]
阅读全文