本文帮助您根据MySQL、Oracle内建函数查找对应的MaxCompute内建函数。

函数类型 MaxCompute HIVE MySQL Oracle
日期函数 DATEDIFF DATEDIFF DATEDIFF MONTHS_BETWEEN
DATEADD DATE_ADD DATE_ADD
DATEPART DATE_FORMAT EXTRACT (datetime)
DATETRUNC TRUNC DATE_FORMAT EXTRACT (datetime)
FROM_UNIXTIME FROM_UNIXTIME FROM_UNIXTIME
GETDATE CURRENT_DATE NOW CURRENT_DATE
ISDATE STR_TO_DATE(返回false则说明不能转换为date)
LASTDAY LAST_DAY LAST_DAY LAST_DAY
TO_DATE TO_DATE STR_TO_DATE() DATE
TO_CHAR DATE_FORMAT TO_CHAR (datetime)
UNIX_TIMESTAMP UNIX_TIMESTAMP UNIX_TIMESTAMP
WEEKDAY WEEKDAY
WEEKOFYEAR WEEKOFYEAR WEEKOFYEAR
YEAR YEAR YEAR YEAR
QUARTER QUARTER QUARTER QUARTER
MONTH MONTH MONTH MONTH
DAY DAY DAY DAY
DAYOFMONTH DAYOFMONTH DAYOFMONTH
HOUR HOUR HOUR HOUR
MINUTE MINUTE MINUTE MINUTE
CURRENT_TIMESTAMP CURRENT_TIMESTAMP CURRENT_TIMESTAMP CURRENT_TIMESTAMP
ADD_MONTHS ADD_MONTHS ADDDATE ADD_MONTHS
LAST_DAY LAST_DAY LAST_DAY
NEXT_DAY NEXT_DAY NEXT_DAY
MONTHS_BETWEEN MONTHS_BETWEEN timestampdiff MONTHS_BETWEEN
数学函数 ABS ABS ABS ABS
ACOS ACOS ACOS ACOS
ASIN ASIN ASIN ASIN
ATAN ATAN ATAN ATAN
CEIL CEIL CEIL CEIL
CONV CONV CONV
COS COS COS COS
COSH COSH COSH
COT COT COT COT
EXP EXP EXP EXP
FLOOR FLOOR FLOOR FLOOR
LN LN LN LN
LOG LOG LOG LOG
POW POW POW POWER
RAND RAND RAND
ROUND ROUND ROUND ROUND
SIN SIN SIN SIN
SINH SINH SINH
SQRT SQRT SQRT SQRT
TAN TAN TAN TAN
TANH TANH TANH
TRUNC TRUNC TRUNCATE TRUNC
LOG2 LOG2 LOG2 LOG
LOG10 LOG10 LOG10 LOG
BIN BIN BIN BITAND
HEX HEX HEX RAWTOHEX
UNHEX UNHEX UNHEX HEXTORAW
RADIANS RADIANS RADIANS RADIANS
DEGREES DEGREES DEGREES DEGREES
SIGN SIGN SIGN SIGN
E E
PI PI PI PI
FACTORIAL FACTORIAL
CBRT CBRT
SHIFTLEFT SHIFTLEFT <<
SHIFTRIGHT SHIFTRIGHT >>
SHIFTRIGHTUNSIGNED SHIFTRIGHTUNSIGNED >>>
窗口函数 DENSE_RANK DENSE_RANK DENSE_RANK DENSE_RANK
RANK RANK RANK RANK
LAG LAG LAG LAG
LEAD LEAD LEAD LEAD
PERCENT_RANK PERCENT_RANK PERCENT_RANK PERCENT_RANK
ROW_NUMBER ROW_NUMBER ROW_NUMBER ROW_NUMBER
CLUSTER_SAMPLE
NTILE NTILE NTILE NTILE
聚合函数 COUNT COUNT COUNT COUNT
AVG AVG AVG AVG
MAX MAX MAX MAX
MIN MIN MIN MIN
MEDIAN MEDIAN
STDDEV STDDEV STDDEV STDDEV
STDDEV_SAMP STDDEV_SAMP STDDEV_SAMP STDDEV_SAMP
SUM SUM SUM SUM
WM_CONCAT GROUP_CONCAT WM_CONCAT
COLLECT_LIST COLLECT LIST COLLECT
COLLECT_SET COLLECT SET COLLECT
VARIANCE/VAR_POP VARIANCE/VAR_POP VAR_POP VARIANCE/VAR_POP
VAR_SAMP VAR_SAMP VAR_SAMP VAR_SAMP
COVAR_POP COVAR_POP COVAR_POP
COVAR_SAMP COVAR_SAMP COVAR_SAMP
PERCENTILE PERCENTILE
字符串函数 CHAR_MATCHCOUNT
CHR CHR CHAR CHR
CONCAT CONCAT CONCAT CONCAT
GET_JSON_OBJECT GET_JSON_OBJECT JSON_EXTRACT()
INSTR INSTR INSTR INSTR
IS_ENCODING
KEYVALUE
LENGTH LENGTH LENGTH LENGTH
LENGTHB LENGTHB LENGTHB LENGTHB
MD5 MD5 MD5
REGEXP_EXTRACT REGEXP_EXTRACT
REGEXP_INSTR REGEXP_INSTR REGEXP_INSTR
REGEXP_REPLACE REGEXP_REPLACE REGEXP_REPLACE REGEXP_REPLACE
REGEXP_SUBSTR REGEXP_SUBSTR REGEXP_SUBSTR
REGEXP_COUNT REGEXP_COUNT
SPLIT_PART
SUBSTR SUBSTR SUBSTR SUBSTR
SUBSTRING SUBSTRING SUBSTRING SUBSTR
TOLOWER LOWER LOWER LOWER
TOUPPER UPPER UPPER UPPER
TRIM TRIM TRIM TRIM
LTRIM LTRIM LTRIM LTRIM
RTRIM RTRIM RTRIM LTRIM
REVERSE REVERSE REVERSE REVERSE
SPACE SPACE SPACE SPACE
REPEAT REPEAT REPEAT REPEAT
ASCII ASCII ASCII ASCII
CONCAT_WS CONCAT_WS CONCAT_WS
LPAD LPAD LPAD LPAD
RPAD RPAD RPAD RPAD
REPLACE REPLACE REPLACE
SOUNDEX SOUNDEX SOUNDEX SOUNDEX
SUBSTRING_INDEX SUBSTRING_INDEX SUBSTRING_INDEX
TRANSLATE TRANSLATE TRANSLATE
URL_DECODE
URL_ENCODE PERCENTILE_CONT
CRC32 CRC32 CRC32
其他函数 CAST CAST CAST CAST
COALESCE COALESCE COALESCE COALESCE
DECODE DECODE DECODE
GET_IDCARD_AGE
GET_IDCARD_BIRTHDAY
GET_IDCARD_SEX
GREATEST GREATEST GREATEST
ORDINAL
LEAST LEAST LEAST LEAST
MAX_PT
UUID UUID UID
SAMPLE
IF IF IF IF
CASE WHEN CASE WHEN CASE WHEN CASE WHEN
SPLIT SPLIT SPLIT
STR_TO_MAP STR_TO_MAP
EXPLODE EXPLODE
MAP MAP
MAP_KEYS MAP_KEYS
MAP_VALUES MAP_VALUES
NVL NVL IFNULL
ARRAY ARRAY
SIZE SIZE
ARRAY_CONTAINS ARRAY_CONTAINS
POSEXPLODE POSEXPLODE
TRANS_ARRAY
INLINE INLINE
NAMED_STRUCT