You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2021/07/14 11:15:13 UTC

[GitHub] [calcite] vnhive commented on a change in pull request #2459: CALCITE-4692 : [Redshift Dialect] Redshift does not support the DOUBLE datatype

vnhive commented on a change in pull request #2459:
URL: https://github.com/apache/calcite/pull/2459#discussion_r669517049



##########
File path: core/src/main/java/org/apache/calcite/sql/dialect/RedshiftSqlDialect.java
##########
@@ -45,4 +49,24 @@ public RedshiftSqlDialect(Context context) {
       @Nullable SqlNode fetch) {
     unparseFetchUsingLimit(writer, offset, fetch);
   }
+
+  @Override public SqlNode getCastSpec(RelDataType type) {
+    String castSpec;
+    switch (type.getSqlTypeName()) {
+    case TINYINT:
+      // Postgres has no tinyint (1 byte), so instead cast to smallint (2 bytes)

Review comment:
       Done.

##########
File path: core/src/main/java/org/apache/calcite/sql/dialect/RedshiftSqlDialect.java
##########
@@ -45,4 +49,24 @@ public RedshiftSqlDialect(Context context) {
       @Nullable SqlNode fetch) {
     unparseFetchUsingLimit(writer, offset, fetch);
   }
+
+  @Override public SqlNode getCastSpec(RelDataType type) {
+    String castSpec;
+    switch (type.getSqlTypeName()) {
+    case TINYINT:
+      // Postgres has no tinyint (1 byte), so instead cast to smallint (2 bytes)
+      castSpec = "smallint";
+      break;
+    case DOUBLE:
+      // Postgres has a double type but it is named differently

Review comment:
       Done.




-- 
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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org