Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
Computes sqrt(a^2 + b^2) without intermediate overflow or underflow. Supports Spark Connect.
For the corresponding Databricks SQL function, see hypot function.
Syntax
from pyspark.sql import functions as dbf
dbf.hypot(col1=<col1>, col2=<col2>)
Parameters
| Parameter | Type | Description |
|---|---|---|
col1 |
pyspark.sql.Column, column name or float |
a leg. |
col2 |
pyspark.sql.Column, column name or float |
b leg. |
Returns
pyspark.sql.Column: length of the hypotenuse.
Examples
from pyspark.sql import functions as dbf
spark.range(1).select(dbf.hypot(dbf.lit(1), dbf.lit(2))).show()
+----------------+
| HYPOT(1, 2)|
+----------------+
|2.23606797749...|
+----------------+