hypot
Computes sqrt(a^2 + b^2) without intermediate overflow or underflow. Supports Spark Connect.
For the corresponding Databricks SQL function, see hypot function.
Syntax
Python
from pyspark.databricks.sql import functions as dbf
dbf.hypot(col1=<col1>, col2=<col2>)
Parameters
Parameter | Type | Description |
|---|---|---|
|
| a leg. |
|
| b leg. |
Returns
pyspark.sql.Column: length of the hypotenuse.
Examples
Python
from pyspark.databricks.sql import functions as dbf
spark.range(1).select(dbf.hypot(dbf.lit(1), dbf.lit(2))).show()
Output
+----------------+
| HYPOT(1, 2)|
+----------------+
|2.23606797749...|
+----------------+