[ 
https://issues.apache.org/jira/browse/BEAM-7024?focusedWorklogId=223914&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-223914
 ]

ASF GitHub Bot logged work on BEAM-7024:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 05/Apr/19 22:47
            Start Date: 05/Apr/19 22:47
    Worklog Time Spent: 10m 
      Work Description: kennknowles commented on pull request #8242: 
[BEAM-7024] Calcite BINARY to Beam Schema BYTES missing in CalciteUtils
URL: https://github.com/apache/beam/pull/8242#discussion_r272764191
 
 

 ##########
 File path: 
sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/utils/CalciteUtils.java
 ##########
 @@ -156,8 +156,26 @@ public static boolean isStringType(FieldType fieldType) {
           .put(TIMESTAMP_WITH_LOCAL_TZ, 
SqlTypeName.TIMESTAMP_WITH_LOCAL_TIME_ZONE)
           .build();
 
-  private static final BiMap<SqlTypeName, FieldType> 
CALCITE_TO_BEAM_TYPE_MAPPING =
-      BEAM_TO_CALCITE_TYPE_MAPPING.inverse();
+  private static final ImmutableMap<SqlTypeName, FieldType> 
CALCITE_TO_BEAM_TYPE_MAPPING =
+      ImmutableMap.<SqlTypeName, FieldType>builder()
+          .put(SqlTypeName.TINYINT, TINY_INT)
+          .put(SqlTypeName.SMALLINT, SMALL_INT)
+          .put(SqlTypeName.INTEGER, INTEGER)
+          .put(SqlTypeName.BIGINT, BIG_INT)
+          .put(SqlTypeName.FLOAT, FLOAT)
+          .put(SqlTypeName.DOUBLE, DOUBLE)
+          .put(SqlTypeName.DECIMAL, DECIMAL)
+          .put(SqlTypeName.BOOLEAN, BOOLEAN)
+          .put(SqlTypeName.VARBINARY, VARBINARY)
+          .put(SqlTypeName.BINARY, VARBINARY)
 
 Review comment:
   OK. It is fine and expected that the mapping might not be invertible.
   
   We want users to be able to feed schema PCollection in to SQL, but also 
compile SQL down to schema. But they don't have to be an exact match. In fact, 
I think Beam schema should probably reduce to only very simple types and the 
rest should be logical types that SQL defines. TODO later.
   
   You will need to replace `VARBINARY` with `BYTES` on the right hand side, no?
 
----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 223914)
    Time Spent: 1h  (was: 50m)

> Calcite BINARY to Beam Schema BYTES missing in CalciteUtils
> -----------------------------------------------------------
>
>                 Key: BEAM-7024
>                 URL: https://issues.apache.org/jira/browse/BEAM-7024
>             Project: Beam
>          Issue Type: Bug
>          Components: dsl-sql
>            Reporter: Rui Wang
>            Assignee: Rui Wang
>            Priority: Major
>          Time Spent: 1h
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to