適用於:
Databricks SQL
Databricks Runtime
傳回具有指定結構值的 CSV 字串。
語法
to_csv(expr [, options] )
引數
-
expr:STRUCT 表達式。 -
options:可選的 MAP 字面量表達式,其鍵和值為字串。
退貨
一條細繩
關於可能的詳細資料請參見函數from_csv。
範例
> SELECT to_csv(named_struct('a', 1, 'b', 2));
1,2
> SELECT to_csv(named_struct('time', to_timestamp('2015-08-26', 'yyyy-MM-dd')), map('timestampFormat', 'dd/MM/yyyy'));
26/08/2015