หมายเหตุ
การเข้าถึงหน้านี้ต้องได้รับการอนุญาต คุณสามารถลอง ลงชื่อเข้าใช้หรือเปลี่ยนไดเรกทอรีได้
การเข้าถึงหน้านี้ต้องได้รับการอนุญาต คุณสามารถลองเปลี่ยนไดเรกทอรีได้
Throws an exception with the provided error message.
Syntax
from pyspark.sql import functions as sf
sf.raise_error(errMsg)
Parameters
| Parameter | Type | Description |
|---|---|---|
errMsg |
pyspark.sql.Column or str |
A Python string literal or column containing the error message. |
Returns
pyspark.sql.Column: throws an error with specified message.
Examples
Example 1: Raise a custom error message
from pyspark.sql import functions as sf
spark.range(1).select(sf.raise_error("My error message")).show()
java.lang.RuntimeException: My error message