v.24.6New Feature

Added SQL functions parseReadableSize with OrNull and OrZero variants

Added SQL functions parseReadableSize (along with OrNull and OrZero variants). #64742 (Francisco J. Jurado Moreno).
Added new SQL functions parseReadableSize, parseReadableSizeOrNull, and parseReadableSizeOrZero to ClickHouse.

Why it matters

These functions allow users to convert human-readable size strings (e.g., '10MB', '5GB') into their corresponding numeric byte values. This solves the problem of manually parsing size expressions in queries and improves query flexibility when working with size-related data.

How to use it

Use the functions directly in SQL queries by passing a string representing the size to parse. For example:

SELECT parseReadableSize('10MB');
SELECT parseReadableSizeOrNull('invalid-size');
SELECT parseReadableSizeOrZero('unknown');

The OrNull variant returns NULL on invalid input, while the OrZero variant returns zero.