R2 SQL Adds 190+ New Functions and Advanced Query Features
Key Points
- 190+ new SQL functions and expressions added
- Common Table Expressions (CTEs) now supported
- Complex data types with struct/array/map access
Summary
Cloudflare R2 SQL has significantly expanded its capabilities with over 190 new functions, expressions, and complex data type support. This serverless analytics query engine for Apache Iceberg tables now supports advanced SQL features including CASE expressions, CTEs, and comprehensive function libraries.
Key Points
- Column aliases -
SELECT col AS aliasnow works across all SQL clauses - CASE expressions - Both searched and simple conditional logic forms supported
- 163 scalar functions - Added across math, string, datetime, regex, crypto, encoding, and type inspection categories
- 33 aggregate functions - Statistical functions (variance, stddev, correlation), bitwise, boolean, and positional aggregates
- Complex type support - Struct field access with bracket notation, 46 array functions, and map key/value extraction
- Common Table Expressions (CTEs) - Chained CTEs supported with
WITH ... ASsyntax (must reference same table) - Full expression support - Arithmetic, type casting (
CAST,TRY_CAST,::shorthand), andEXTRACTin all clauses