Hide function 1

Time:2021-7-26
insert overwrite table ... partition(platform_id)
select
if(user_id regexp('.*:.*'),user_id,concat(platform_id,':',user_id)) as
user_id,
...,
last_onlined_at,created_at,rating_score,updated_at,noise,platform_id from `XXX`;

concat

concat(platform_id,’:’,user_id)) as
user_id
Concat splice alias is user_ id

if

If () is equivalent to the ternary operator
If (conditional expression, result 1, result 2) is equivalent to the ternary operator in Java, but the expression types behind if can be different.
The equal condition in if can be expressed as “=” or “= =”

REGEXP_EXTRACT

regexp_extract(string A, string pattern, int index)
Return value: String
Description: split the string a according to the rules of pattern regular expression and return the character specified by index. Index starts from 1.

REGEXP_REPLACE

Syntax: regexp_ replace(string A, string B, string C)
Operation type: strings
Return value: String
Description: replace the part of string a that conforms to Java regular expression B with C.

hive> select regexp_replace('h234ney', '\\d+', 'o');
OK
honey