TO_JSON (Lakehouse v2)
将 SQL 值转换为 JSON 值。
Analyze 语法
Section titled “Analyze 语法”func.to_json(get_column(table, 'struct_col'))Analyze 示例
Section titled “Analyze 示例”func.to_json(func.named_struct('name', 'Alice', 'age', 30))
┌───────────────────────────┐│ {"name":"Alice","age":30} │└───────────────────────────┘SQL 语法
Section titled “SQL 语法”TO_JSON(<struct_col>)SQL 示例
Section titled “SQL 示例”SELECT TO_JSON(NAMED_STRUCT('name', 'Alice', 'age', 30));
┌───────────────────────────┐│ {"name":"Alice","age":30} │└───────────────────────────┘