This is an automated email from the ASF dual-hosted git repository.
zabetak pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/calcite.git
The following commit(s) were added to refs/heads/master by this push:
new 1da412a [CALCITE-4690] Error when executing query with CHARACTER SET
in Redshift
1da412a is described below
commit 1da412aa26fe374714bdac29f5d51adf400c8f72
Author: Stamatis Zampetakis <[email protected]>
AuthorDate: Sat Jul 10 08:34:19 2021 +0300
[CALCITE-4690] Error when executing query with CHARACTER SET in Redshift
Close apache/calcite#2457
---
.../org/apache/calcite/sql/dialect/RedshiftSqlDialect.java | 4 ++++
.../org/apache/calcite/rel/rel2sql/RelToSqlConverterTest.java | 11 +++++++++++
2 files changed, 15 insertions(+)
diff --git
a/core/src/main/java/org/apache/calcite/sql/dialect/RedshiftSqlDialect.java
b/core/src/main/java/org/apache/calcite/sql/dialect/RedshiftSqlDialect.java
index 586d3ae..243a6f6 100644
--- a/core/src/main/java/org/apache/calcite/sql/dialect/RedshiftSqlDialect.java
+++ b/core/src/main/java/org/apache/calcite/sql/dialect/RedshiftSqlDialect.java
@@ -45,4 +45,8 @@ public class RedshiftSqlDialect extends SqlDialect {
@Nullable SqlNode fetch) {
unparseFetchUsingLimit(writer, offset, fetch);
}
+
+ @Override public boolean supportsCharSet() {
+ return false;
+ }
}
diff --git
a/core/src/test/java/org/apache/calcite/rel/rel2sql/RelToSqlConverterTest.java
b/core/src/test/java/org/apache/calcite/rel/rel2sql/RelToSqlConverterTest.java
index f272e7c..c48931b 100644
---
a/core/src/test/java/org/apache/calcite/rel/rel2sql/RelToSqlConverterTest.java
+++
b/core/src/test/java/org/apache/calcite/rel/rel2sql/RelToSqlConverterTest.java
@@ -1599,6 +1599,17 @@ class RelToSqlConverterTest {
sql(query).withMssql().ok(expected);
}
+ /** Test case for
+ * <a
href="https://issues.apache.org/jira/browse/CALCITE-4690">[CALCITE-4690]
+ * Error when executing query with CHARACTER SET in Redshift</a>. */
+ @Test void testRedshiftCharacterSet() {
+ String query = "select \"hire_date\", cast(\"hire_date\" as varchar(10))\n"
+ + "from \"foodmart\".\"reserve_employee\"";
+ final String expected = "SELECT \"hire_date\", CAST(\"hire_date\" AS
VARCHAR(10))\n"
+ + "FROM \"foodmart\".\"reserve_employee\"";
+ sql(query).withRedshift().ok(expected);
+ }
+
@Test void testExasolCharacterSet() {
String query = "select \"hire_date\", cast(\"hire_date\" as varchar(10))\n"
+ "from \"foodmart\".\"reserve_employee\"";