tanclary commented on code in PR #3565:
URL: https://github.com/apache/calcite/pull/3565#discussion_r1432903188
##########
core/src/main/java/org/apache/calcite/sql/fun/SqlLibrary.java:
##########
@@ -73,7 +73,9 @@ public enum SqlLibrary {
POSTGRESQL("p", "postgresql"),
/** A collection of operators that are in Apache Spark but not in standard
* SQL. */
- SPARK("s", "spark");
+ SPARK("s", "spark"),
+ /** A collection of operators that are in Snowflake but not in standard SQL.
*/
+ SNOWFLAKE("s", "snowflake");
Review Comment:
Changed to `f` and re-ordered list.
##########
core/src/test/java/org/apache/calcite/rel/rel2sql/RelToSqlConverterTest.java:
##########
@@ -6557,6 +6557,34 @@ private void checkLiteral2(String expression, String
expected) {
sql(sql).withMysql().ok(expectedMysql);
}
+ /** Test case for
+ * <a
href="https://issues.apache.org/jira/browse/CALCITE-6156">[CALCITE-6156]
+ * Add ENDSWITH, STARTSWITH functions (enabled in Postgres, Snowflake
libraries)</a>. */
+ @Test void testSnowflakeStartsWith() {
+ final String bigQuerySql = "select starts_with(\"brand_name\",
'a')\n"
+ + "from \"product\"";
+ final String snowflakeSql = "select startswith(\"brand_name\", 'a')\n"
+ + "from \"product\"";
+ final String expected = "SELECT STARTSWITH(\"brand_name\" 'a')\n"
+ + "FROM \"foodmart\".\"product\"";
+
sql(bigQuerySql).withLibrary(SqlLibrary.BIG_QUERY).withSnowflake().ok(expected);
+
sql(snowflakeSql).withLibrary(SqlLibrary.SNOWFLAKE).withSnowflake().ok(expected);
Review Comment:
Adjusted
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]