检测到您已登录华为云国际站账号,为了您更好的体验,建议您访问国际站服务网站 https://www.huaweicloud.com/intl/zh-cn
不再显示此消息
lpad locate函数用于返回指定长度的字符串,给定字符串str1长度小于指定长度length时,由指定字符str2从左侧填补。 命令格式 lpad(string <str1>, int <length>, string <str2>) 参数说明 表1 参数说明 参数 是否必选
add_months add_months函数用于计算日期值增加指定月数后的日期。即start_date在num_months个月之后的date。 命令格式 add_months(string start_date, int num_months) 参数说明 表1 参数说明 参数
conv conv函数用于进制转换,将from_base进制下的num转化为to_base进制下面的数。 命令格式 conv(BIGINT num, INT from_base, INT to_base) 参数说明 表1 参数说明 参数 是否必选 参数类型 说明 num 是 DO
date_format date_format函数用于将date按照format指定的格式转换为字符串。 命令格式 date_format(string date, string format) 参数说明 表1 参数说明 参数 是否必选 参数类型 说明 date 是 DATE 或
datepart datepart函数用于计算日期date中符合指定时间单位datepart的值。 命令格式 datepart(string date,string datepart) 参数说明 表1 参数说明 参数 是否必选 参数类型 说明 date 是 DATE 或 STRING
locate locate函数用于在str中查找substr的位置。您可以通过start_pos指定开始查找的位置,从1开始计数。 命令格式 locate(string <substr>, string <str>[, bigint <start_pos>]) 参数说明 表1 参数说明
from_utc_timestamp from_utc_timestamp函数用于计算将UTC的时间戳转化为timezone所对应的UNIX格式的时间戳。 命令格式 from_utc_timestamp(string timestamp, string timezone) 参数说明
keyvalue keyvalue函数用于计算将字符串str按照split1进行切分,并按split2将每组变成Key-Value对,返回key所对应的Value。 命令格式 keyvalue(string <str>,[string <split1>,string <split2>
datediff datediff函数用于计算两个时间date1、date2的日期差值。 相似函数:datediff1,datediff1函数用于计算两个时间date1、date2的差值,将差值以指定的时间单位datepart表示。 命令格式 datediff(string date1
to_date1 to_date1函数用于将指定格式的字符串转换为日期值。 相似函数:to_date,to_date函数用于返回时间中的年月日,不支持指定转换的日期格式。 命令格式 to_date1(string date, string format) 参数说明 表1 参数说明
instr instr函数用于返回substr在str中最早出现的下标。 当参数中出现NULL时,返回NULL,当str中不存在substr时返回0,注意下标从1开始。 相似函数:instr1,instr1函数用于计算子串str2在字符串str1中的位置,instr1函数支持指定起始搜索位置和匹配次数。
to_char to_char函数用于将日期按照指定格式转换为字符串。 命令格式 to_char(string date, string format) 参数说明 表1 参数说明 参数 是否必选 参数类型 说明 date 是 DATE 或 STRING 代表需要处理的日期。 格式为:
concat_ws concat_ws函数用于连接多个字符串,字符串之间以指定的分隔符分隔。 命令格式 concat_ws(string <separator>, string <str1>, string <str2>[,...]) 或 concat_ws(string <separator>
ltrim ltrim函数用于从str的左端去除字符: 如果未指定trimChars,则默认去除空格字符。 如果指定了trimChars,则以trimChars中包含的字符作为一个集合,从str的左端去除尽可能长的所有字符都在集合trimChars中的子串。 相似函数: rtri
months_between months_between函数用于返回date1与date2之间的月份差。 命令格式 months_between(string date1, string date2) 参数说明 表1 参数说明 参数 是否必选 参数类型 说明 date1 是 DATE
percentlie_approx percentile_approx函数用于计算近似百分位数,适用于大数据量。先对指定列升序排列,然后取第p位百分数最靠近的值。 命令格式 percentile_approx (colname,DOUBLE p) 参数说明 表1 参数说明 参数 是否必选
regexp_substr regexp_substr函数用于计算从start_position位置开始,source中第occurrence次匹配指定pattern的子串。 命令格式 regexp_substr(string <source>, string <pattern>[
trim trim函数用于从str的左右两端去除字符: 如果未指定trimChars,则默认去除空格字符。 如果指定了trimChars,则以trimChars中包含的字符作为一个集合,从str的左右两端去除尽可能长的所有字符都在集合trimChars中的子串。 相似函数: lt
date_sub date_sub函数按照days幅度递减startdate日期的天数。 如需要获取当前日期基础上指定变动幅度的日期,可结合current_date或getdate函数共同使用。 请注意date_sub函数与date_add函数逻辑反。 命令格式 date_sub(string
next_day next_day函数用于返回start_date之后最接近day_of_week的日期。 命令格式 next_day(string start_date, string day_of_week) 参数说明 表1 参数说明 参数 是否必选 参数类型 说明 start_date