COALESCE (Lakehouse v1)
Devolve a primeira expressão não NULL entre os seus argumentos; se todos os argumentos forem NULL, devolve NULL.
Sintaxe do Analyze
Seção intitulada “Sintaxe do Analyze”func.coalesce(<expr1>[, <expr2> ...])Exemplos do Analyze
Seção intitulada “Exemplos do 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_soldSintaxe SQL
Seção intitulada “Sintaxe SQL”COALESCE(<expr1>[, <expr2> ...])Exemplos SQL
Seção intitulada “Exemplos SQL”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 │└────────────────────────────────────────────────────────────────┘