Skip to content
Advertisement

Presto equivalent of CONCAT_WS

I’m looking for a function in Presto to concat two columns with a separator like underline.

Advertisement

Answer

Your are looking here for the array_join function, see docs.

array_join(x, delimiter, null_replacement) → varchar

Concatenates the elements of the given array using the delimiter and an optional string to replace nulls.

Example:
columns are c1,c2 you can add more of course:

Results will be:
1_2
3_4
5_NA
7_8

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement