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.
Returns true if the XPath expression evaluates to true, or if a matching node is found.
Syntax
from pyspark.sql import functions as sf
sf.xpath_boolean(xml, path)
Parameters
| Parameter | Type | Description |
|---|---|---|
xml |
pyspark.sql.Column or str |
XML column or column name. |
path |
pyspark.sql.Column or str |
XPath expression. |
Examples
from pyspark.sql import functions as sf
df = spark.createDataFrame([('<a><b>1</b></a>',)], ['x'])
df.select(sf.xpath_boolean(df.x, sf.lit('a/b'))).show()
+---------------------+
|xpath_boolean(x, a/b)|
+---------------------+
| true|
+---------------------+