Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Returns the merged schema in the SQL format of a variant column.
Syntax
from pyspark.sql import functions as sf
sf.schema_of_variant_agg(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_agg(sf.parse_json(df.json)).alias("r")).collect()
[Row(r='OBJECT<a: BIGINT>')]