v.19.8New Features
Add a Function Basename, with a Similar Behaviour to a Basename Function, Which Exists in a Lot of Languages (os.path.basename in Python, Basename in Php, Etc...)
Add a function basename, with a similar behaviour to a basename function, which exists in a lot of languages (os.path.basenamein python,basenamein PHP, etc...). Work with both an UNIX-like path or a Windows path. #5136 (Guillaume Tassery)
Why it matters
This feature provides a newbasename function similar to those found in many programming languages (e.g., os.path.basename in Python, basename in PHP). It simplifies extracting the final component (file name) from both UNIX-like and Windows-style file paths, improving path manipulation capabilities in ClickHouse.How to use it
Use thebasename function in SQL queries by passing a path string as the argument. It returns the last part of the path. Example usage:SELECT basename('/path/to/file.txt');
-- Returns 'file.txt'
SELECT basename('C:\folder\file.txt');
-- Returns 'file.txt'