v.25.8Performance Improvement

Optimize the materialization of constants

Optimize the materialization of constants in cases when we do this materialization only to return a single row. #85071 (Alexey Milovidov).