Description
REMAP_VALUES / REMAP_INTS allows you to map values of a column. REMAP_VALUES takes a column of type STRING and REMAP_INTS of type INT.
The first argument is followed by multiple pairs of values (at least one pair) which specify which old value should be replaced by which new value. For REMAP_VALUES the old and new values must be of type STRING and for REMAP_INTS of type INT. As a last argument a value of type STRING respectively INT can be specified optionally to replace all not mentioned values from the list of pairs by this value. If such a value is missing, all values not mentioned in the list of pairs stay the same.
If a new value occurs in multiple pairs only the last pair is used.
You can achieve the same with a CASE WHEN statement but REMAP_VALUES / REMAP_INTS is faster and the syntax is more compact.
Syntax
REMAP_VALUES ( table.column, [ old_value1, new_value1 ] (, [ old_valueN, new_valueN ] )* [, others_value ] )
REMAP_INTS ( table.column, [ old_value1, new_value1 ] (, [ old_valueN, new_valueN ] )* [, others_value ] )