赞
踩
Hive提供大量内置函数供开发者使用
案例:
select locate("Plaza",customer_street) rst from customers where locate("Plaza",customer_street) <>0
select split(customer_street," ") rst from customers
select customer_street,split(customer_street," ") rst,str_to_map(customer_street,":"," ") from customers
#将customers表中所有顾客姓名转换成大写
select upper(concat(customer_fname,"·",customer_lname)) from customers
案例:
select customer_street,binary(customer_street,"latin")rst from customers
select customer_street,binary(customer_street,"latin"),cast(split(customer_street," ")[0] as bigint)r from customers where cast(split(customer_street," ")[0] as bigint)<6000
案例:
#将orders表中订单金额保留两位小数
select round(order_item_subtotal,2) from order_items
案例:
select from_unixtime(1600740000,"yyyy-MM-dd HH:mm:ss.S")rst1, unix_timestamp()rst2, unix_timestamp("1970-01-01 08:00:00")rst3,
to_date("2020-09-22 09:43:20")rst4, datediff("2020-09-22 09:43:20","2020-09-22 23:43:20")rst5,
date_add("2020-09-22 09:43:20",-1)rst6, date_format(
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。