concat_ws function

Returns the concatenation strings separated by sep.

Syntax

concat_ws(sep [, expr1 [, ...] ])

Arguments

  • sep: An STRING expression.

  • exprN: Each exprN can be either a STRING or an ARRAY of STRING.

Returns

The result type is STRING.

If sep is NULL the result is NULL. exprN that are NULL are ignored. If only the separator is provided, or all exprN are NULL, an empty string.

Examples

> SELECT concat_ws(' ', 'Spark', 'SQL');
  Spark SQL
> SELECT concat_ws('s');
  ''
> SELECT concat_ws(',', 'Spark', array('S', 'Q', NULL, 'L'), NULL);
  Spark,S,Q,L