v.21.3New Feature

Added file function for reading files from user_files directory

Added file function to read file from user_files directory as a String. This is different from the file table function. This implements #issue:18851. #19204 (keenwolf).
Introduced a new file function to read the contents of a file from the user_files directory as a String, distinct from the existing file table function.

Why it matters

This feature enables users to directly read and retrieve file contents as a text string within ClickHouse queries, simplifying workflows that require inline access to file data without using table functions or external tools.

How to use it

Use the file function by passing the filename located in the user_files directory to read its contents as a String. For example:

SELECT file('example.txt')

This function returns the entire file content as a single String.