Бележка
Достъпът до тази страница изисква удостоверяване. Можете да опитате да влезете или да промените директориите.
Достъпът до тази страница изисква удостоверяване. Можете да опитате да промените директориите.
Overlay the specified portion of src with replace, starting from byte position pos of src and proceeding for len bytes.
For the corresponding Databricks SQL function, see overlay function.
Syntax
from pyspark.databricks.sql import functions as dbf
dbf.overlay(src=<src>, replace=<replace>, pos=<pos>, len=<len>)
Parameters
| Parameter | Type | Description |
|---|---|---|
src |
pyspark.sql.Column or str |
the string that will be replaced |
replace |
pyspark.sql.Column or str |
the substitution string |
pos |
pyspark.sql.Column or str or int |
the starting position in src |
len |
pyspark.sql.Column or str or int, optional |
the number of bytes to replace in src string by 'replace' defaults to -1, which represents the length of the 'replace' string |
Returns
pyspark.sql.Column: string with replaced values.
Examples
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([("SPARK_SQL", "CORE")], ("x", "y"))
df.select("*", dbf.overlay("x", df.y, 7)).show()
df.select("*", dbf.overlay("x", df.y, 7, 0)).show()
df.select("*", dbf.overlay("x", "y", 7, 2)).show()