v.20.9New Feature
Added Column Transformers EXCEPT, REPLACE, and APPLY for Enhanced SQL Queries
Added column transformersEXCEPT,REPLACE,APPLY, which can be applied to the list of selected columns (after*orCOLUMNS(...)). For example, you can writeSELECT * EXCEPT(URL) REPLACE(number + 1 AS number). Another example:select * apply(length) apply(max) from wide_string_tableto find out the maxium length of all string columns. #14233 (Amos Bird).
Why it matters
These transformers provide enhanced flexibility in selecting and modifying columns directly in theSELECT clause, allowing users to exclude specific columns, replace or modify columns with expressions, and apply functions across multiple columns efficiently. This simplifies query writing and expands the ability to process wide tables without manually listing columns.How to use it
Use the transformers immediately after selecting columns with or COLUMNS(...). For example, to exclude a column and replace another: SELECT EXCEPT(URL) REPLACE(number + 1 AS number) To apply functions to all selected columns:
SELECT * APPLY(length) APPLY(max) FROM wide_string_table