日期/时间函数
函数 | 描述 |
---|---|
add_months | 在日期中添加月份 |
date_add | 在日期中添加天数 |
date_format | 修改日期格式 |
date_sub | 从日期减去天数 |
date_trunc | 返回截断为指定单位的日期 |
datediff | 返回日期之间的天数差 |
day ,dayofmonth | 返回月中日 |
dayofweek | 返回星期几(1-7) |
dayofyear | 返回年中哪天 |
from_unixtime | 以UNIX®时间返回日期 |
from_utc_timestamp | 以UTC时间返回日期 |
hour | 返回输入的小时数 |
last_day | 返回日期所属月份的最后一天 |
minute | 返回输入的分钟数 |
month | 返回输入的月份 |
months_between | 月数介于 |
next_day | 返回比输入晚的第一天 |
quarter | 返回输入的季度 |
second | 返回字符串的秒数 |
to_date | 将字符串转换为日期。 注意: 字符串 必须 的格式为yyyy-mm-ddTHH24:MM:SS 。 |
to_timestamp | 将字符串转换为时间戳。 注意: 字符串 必须 的格式为yyyy-mm-ddTHH24:MM:SS 。 |
to_unix_timestamp | 将字符串转换为UNIX®时间戳 |
to_utc_timestamp | 将字符串转换为UTC时间戳 |
trunc | 截断日期 |
unix_timestamp | 返回UNIX®时间戳 |
weekday | 星期几(0-6) |
weekofyear | 返回给定日期在一年中的哪一周 |
year | 返回字符串的年份 |
数组
函数 | 描述 |
---|---|
array | 创建具有给定元素的数组 |
array_contains | 检查数组是否包含值 |
array_distinct | 从数组中删除重复的值 |
array_except | 返回第一个数组中元素的数组,但不返回第二个数组中的元素数组 |
array_intersect | 返回两个数组的交集 |
array_join | 将两个数组连接在一起 |
array_max | 返回数组的最大值 |
array_min | 返回数组的最小值 |
array_position | 返回元素从1开始的位置 |
array_remove | 删除与该元素相等的所有元素 |
array_repeat | 创建一个包含已计数次数的值的数组 |
array_sort | 对数组排序 |
array_union | 将数组连接在一起,没有任何重复项 |
arrays_zip | 将给定数组的值与给定索引处的原始集合的值组合在一起 |
cardinality | 返回数组的大小 |
element_at | 返回位置的元素 |
explode | 将数组的元素分隔为多行,不包括null |
explode_outer | 将数组的元素分隔为多个行,包括null |
find_in_set | 返回数组的从1开始的位置 |
flatten | 拼合阵列阵列 |
inline | 将结构数组分隔到表中,不包括null |
inline_outer | 将结构数组分隔到表中,包括空值 |
posexplode | 将数组的元素分隔为多个具有位置的行,但不包括null |
reverse | 反转数组的元素 |
shuffle | 返回数组的随机置换 |
slice | 将数组设为子集 |
sort_array | 按顺序对数组排序 |
zip_with | 在应用函数之前,将两个数组合并到单个数组中 |