Skip to content

Commit

Permalink
Merge pull request #58358 from ClickHouse/format-constexpr
Browse files Browse the repository at this point in the history
Make function `format` return a constant on constant arguments.
  • Loading branch information
alexey-milovidov committed Dec 30, 2023
2 parents 1d34402 + 9d8c263 commit ebd9558
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Functions/format.cpp
Expand Up @@ -39,6 +39,7 @@ class FormatFunction : public IFunction

size_t getNumberOfArguments() const override { return 0; }

bool useDefaultImplementationForConstants() const override { return true; }
ColumnNumbers getArgumentsThatAreAlwaysConstant() const override { return {0}; }

DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override
Expand Down
1 change: 1 addition & 0 deletions tests/queries/0_stateless/02956_format_constexpr.reference
@@ -0,0 +1 @@
1
1 change: 1 addition & 0 deletions tests/queries/0_stateless/02956_format_constexpr.sql
@@ -0,0 +1 @@
SELECT isConstant(format('{}, world', 'Hello'));

0 comments on commit ebd9558

Please sign in to comment.