v.24.8New Feature

Add printf function for Spark compatibility

Add function printf for Spark compatibility (but you can use the existing format function). #66257 (李扬).
Added the printf function to ClickHouse for compatibility with Spark, providing a familiar formatting function alongside the existing format function.

Why it matters

The addition of the printf function addresses the need for compatibility with Spark SQL syntax, allowing users migrating or integrating with Spark to use familiar string formatting functions in ClickHouse without rewriting queries.

How to use it

Use the printf function in your SQL queries similarly to Spark's syntax, for example:
SELECT printf('%s-%d', 'example', 1)
This function works alongside the existing format function and does not require special enabling.