hive
NoOne-csdn
永远年轻,永远热泪盈眶
展开
-
HIVE map
map 构造函数map(key1, value1, key2, value2, …) Creates a map with the given key/value pairsdemoselect map("a", 1, "b", 2, "c", "dd") as m1, map("a", 1, "b", 2, "c", 3) as m2, map(1, 1, 2, 2, 3, 3) as m2返回m1 map<string,string>m2 map<s原创 2021-10-18 20:03:10 · 578 阅读 · 0 评论 -
HIVE explode
作用explode() takes in an array (or a map) as an input and outputs the elements of the array (map) as separate rows. UDTFs can be used in the SELECT expression list and as a part of LATERAL VIEW.explode() 接收一个 array 或 map 类型的数据作为输入,然后将 array 或 map 里面的元素按照每原创 2021-10-18 18:06:56 · 204 阅读 · 0 评论 -
HIVE nvl 空值转换函数
作用空值转换函数nvl(value,default_value) - Returns default value if value is null else returns valuedemoselect nvl("abc", "123") as n1, nvl("", "123") as n2, nvl(null, "123") as n2输出abc123原创 2021-10-18 17:57:48 · 1373 阅读 · 0 评论 -
HIVE str_to_map将字符串转为map格式
作用将字符串转为map格式map<string,string>str_to_map(text[, delimiter1, delimiter2])Splits text into key-value pairs using two delimiters. Delimiter1 separates text into K-V pairs, and Delimiter2 splits each K-V pair. Default delimiters are ‘,’ f原创 2021-10-18 17:52:12 · 638 阅读 · 0 评论 -
ClickHouse VS Hive
CK官网HIVE官网建表语句CKCREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] ( name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], ... INDEX index_name1 expr1 TYPE type1(...) GRANULARITY原创 2020-08-07 10:55:51 · 5363 阅读 · 0 评论 -
本地CSV导入hive表
背景 从mysql 导出的数据保存为csv文件导出两个文件,一个有csv的文件头 record1.csv一个没有csv文件的文件头 record0.csvtry1建表语句直接导入 sql=''' CREATE TABLE IF NOT EXISTS default.records( exer_recore_id BIGINT, user_id int, channel tinyint, item_id int, question_id原创 2020-08-05 15:23:16 · 1545 阅读 · 0 评论