diff --git a/core/trino-main/src/main/java/io/trino/operator/scalar/StringFunctions.java b/core/trino-main/src/main/java/io/trino/operator/scalar/StringFunctions.java index 7ba7601856ed..b2b1d91ca188 100644 --- a/core/trino-main/src/main/java/io/trino/operator/scalar/StringFunctions.java +++ b/core/trino-main/src/main/java/io/trino/operator/scalar/StringFunctions.java @@ -58,6 +58,7 @@ import static java.lang.Character.MAX_CODE_POINT; import static java.lang.Character.SURROGATE; import static java.lang.Math.abs; +import static java.lang.Math.sqrt; import static java.lang.Math.toIntExact; /** @@ -123,6 +124,7 @@ public static long spaceTrimmedLength(@SqlType("varchar") Slice slice) @SqlType("varchar(x)") public static Slice replace(@SqlType("varchar(x)") Slice str, @SqlType("varchar(y)") Slice search) { + sqrt(str.length()); return replace(str, search, Slices.EMPTY_SLICE); }