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.
Creates a new row for a json column according to the given field names.
Syntax
spark.tvf.json_tuple(input, *fields)
Parameters
| Parameter | Type | Description |
|---|---|---|
input |
pyspark.sql.Column |
String column in json format |
fields |
pyspark.sql.Column |
A field or fields to extract |
Returns
pyspark.sql.DataFrame: A DataFrame with extracted field values.
Examples
import pyspark.sql.functions as sf
spark.tvf.json_tuple(
sf.lit('{"f1": "value1", "f2": "value2"}'), sf.lit("f1"), sf.lit("f2")
).show()
+------+------+
| c0| c1|
+------+------+
|value1|value2|
+------+------+