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.
Returns schema in the SQL format of a variant.
Syntax
from pyspark.sql import functions as sf
sf.schema_of_variant(v)
Parameters
| Parameter | Type | Description |
|---|---|---|
v |
pyspark.sql.Column or str |
A variant column or column name. |
Returns
pyspark.sql.Column: a string column representing the variant schema
Examples
from pyspark.sql import functions as sf
df = spark.createDataFrame([ {'json': '''{ "a" : 1 }'''} ])
df.select(sf.schema_of_variant(sf.parse_json(df.json)).alias("r")).collect()
[Row(r='OBJECT<a: BIGINT>')]