From 12e9ad4550caf3482b33895d2067ba50177bb8ba Mon Sep 17 00:00:00 2001 From: Oliver Lee Date: Fri, 11 Nov 2022 18:19:36 +0000 Subject: [PATCH] [CALCITE-5383] Add CONCAT to BIG_QUERY dialect Close #2970 --- .../java/org/apache/calcite/sql/fun/SqlLibraryOperators.java | 2 +- site/_docs/reference.md | 2 +- .../src/main/java/org/apache/calcite/test/SqlOperatorTest.java | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/apache/calcite/sql/fun/SqlLibraryOperators.java b/core/src/main/java/org/apache/calcite/sql/fun/SqlLibraryOperators.java index 306a33b39fda..1cde5d140f10 100644 --- a/core/src/main/java/org/apache/calcite/sql/fun/SqlLibraryOperators.java +++ b/core/src/main/java/org/apache/calcite/sql/fun/SqlLibraryOperators.java @@ -539,7 +539,7 @@ private SqlLibraryOperators() { /** The "CONCAT(arg, ...)" function that concatenates strings. * For example, "CONCAT('a', 'bc', 'd')" returns "abcd". */ - @LibraryOperator(libraries = {MYSQL, POSTGRESQL}) + @LibraryOperator(libraries = {MYSQL, POSTGRESQL, BIG_QUERY}) public static final SqlFunction CONCAT_FUNCTION = new SqlFunction("CONCAT", SqlKind.OTHER_FUNCTION, diff --git a/site/_docs/reference.md b/site/_docs/reference.md index 15abb9b23b4d..ddf4698ccbb3 100644 --- a/site/_docs/reference.md +++ b/site/_docs/reference.md @@ -2584,7 +2584,7 @@ semantics. | o p | CHR(integer) | Returns the character whose UTF-8 code is *integer* | o | COSH(numeric) | Returns the hyperbolic cosine of *numeric* | o | CONCAT(string, string) | Concatenates two strings -| m p | CONCAT(string [, string ]*) | Concatenates two or more strings +| b m p | CONCAT(string [, string ]*) | Concatenates two or more strings | m | COMPRESS(string) | Compresses a string using zlib compression and returns the result as a binary string. | p | CONVERT_TIMEZONE(tz1, tz2, datetime) | Converts the timezone of *datetime* from *tz1* to *tz2* | b | CURRENT_DATETIME([timezone]) | Returns the current time as a TIMESTAMP from *timezone* diff --git a/testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java b/testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java index 9d011d7d5094..70861df1c52f 100644 --- a/testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java +++ b/testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java @@ -1834,6 +1834,7 @@ protected static Calendar getCalendarNotTooNear(int timeUnit) { final SqlOperatorFixture f = fixture(); checkConcatFunc(f.withLibrary(SqlLibrary.MYSQL)); checkConcatFunc(f.withLibrary(SqlLibrary.POSTGRESQL)); + checkConcatFunc(f.withLibrary(SqlLibrary.BIG_QUERY)); checkConcat2Func(f.withLibrary(SqlLibrary.ORACLE)); }