You are accidentally debug-escaping the format string in the .arg() of the Command. This works. (You probably confused shell-escaping with .arg()? Escaping doesn't happen here, you are literally passing the prepared arguments to the command, the shell has no say in it.)
Thanks! I never knew that, and I was always thinking about checking the existence of files.
Now the error from cat is clearer to me than that from clickhouse...
// clickhouse error:
stderr = Code: 107. DB::ErrnoException: Cannot open file "/tmp/.tmp7AJJ9D/1-xxx/__full.sql", errno: 2, strerror: No such file or directory. (FILE_DOESNT_EXIST)
// cat error:
stderr = cat: '"/tmp/.tmp7AJJ9D/1-xxx/__full.sql"': No such file or directory