COALESCE (Lakehouse v1)
引数の中で最初のNULLではない式を返します。すべての引数がNULLの場合は、NULLを返します。
Analyzeの構文
Section titled “Analyzeの構文”func.coalesce(<expr1>[, <expr2> ...])Analyzeの例
Section titled “Analyzeの例”func.coalesce(table.UOM, 'none', \n)
func.coalesce(get_column(table2, 'TECHNOLOGY_RATE'), 0.0)
func.coalesce(table_beta.adjusted_price, table_alpha.override_price, table_alpha.price) * table_beta.quantity_soldSQLの構文
Section titled “SQLの構文”COALESCE(<expr1>[, <expr2> ...])SELECT COALESCE(1), COALESCE(1, NULL), COALESCE(NULL, 1, 2);
┌────────────────────────────────────────────────────────┐│ coalesce(1) │ coalesce(1, null) │ coalesce(null, 1, 2) │├─────────────┼───────────────────┼──────────────────────┤│ 1 │ 1 │ 1 │└────────────────────────────────────────────────────────┘
SELECT COALESCE('a'), COALESCE('a', NULL), COALESCE(NULL, 'a', 'b');
┌────────────────────────────────────────────────────────────────┐│ coalesce('a') │ coalesce('a', null) │ coalesce(null, 'a', 'b') │├───────────────┼─────────────────────┼──────────────────────────┤│ a │ a │ a │└────────────────────────────────────────────────────────────────┘