Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Concatenates multiple input string columns together into a single string column, using the given separator.
For the corresponding Databricks SQL function, see concat_ws function.
Syntax
from pyspark.databricks.sql import functions as dbf
dbf.concat_ws(sep=<sep>, *cols=<*cols>)
Parameters
| Parameter | Type | Description |
|---|---|---|
sep |
literal string |
words separator. |
cols |
pyspark.sql.Column or str |
list of columns to work on. |
Returns
pyspark.sql.Column: string of concatenated words.
Examples
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([("abcd", "123")], ["s", "d"])
df.select("*", dbf.concat_ws("-", df.s, "d", dbf.lit("xyz"))).show()