xpath_long
Renvoie une valeur entière longue, ou la valeur zéro si aucune correspondance n'est trouvée, ou si une correspondance est trouvée mais que la valeur est non numérique.
Syntaxe
Python
from pyspark.sql import functions as sf
sf.xpath_long(xml, path)
parameter
parameter | Type | Description |
|---|---|---|
|
| Colonne XML ou nom de colonne. |
|
| Expression XPath. |
Exemples
Python
from pyspark.sql import functions as sf
df = spark.createDataFrame([('<a><b>1</b><b>2</b></a>',)], ['x'])
df.select(sf.xpath_long(df.x, sf.lit('sum(a/b)'))).show()
Output
+-----------------------+
|xpath_long(x, sum(a/b))|
+-----------------------+
| 3|
+-----------------------+