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

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

                Author: ASF GitHub Bot
            Created on: 30/May/18 18:11
            Start Date: 30/May/18 18:11
    Worklog Time Spent: 10m 
      Work Description: kennknowles commented on a change in pull request 
#5497: [BEAM-4082] Migrate from builders in RowSqlTypes to just using Schema 
builder directly
URL: https://github.com/apache/beam/pull/5497#discussion_r191864047
 
 

 ##########
 File path: 
sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/utils/CalciteUtils.java
 ##########
 @@ -67,6 +67,21 @@
   private static final BiMap<SqlTypeName, FieldType> 
CALCITE_TO_BEAM_TYPE_MAPPING =
       BEAM_TO_CALCITE_TYPE_MAPPING.inverse();
 
+  // The list of field type names used in SQL as Beam field types.
+  public static final FieldType TINY_INT = toFieldType(SqlTypeName.TINYINT);
+  public static final FieldType SMALL_INT = toFieldType(SqlTypeName.SMALLINT);
+  public static final FieldType INTEGER = toFieldType(SqlTypeName.INTEGER);
+  public static final FieldType BIG_INT = toFieldType(SqlTypeName.BIGINT);
+  public static final FieldType FLOAT = toFieldType(SqlTypeName.FLOAT);
+  public static final FieldType DOUBLE = toFieldType(SqlTypeName.DOUBLE);
+  public static final FieldType DECIMAL = toFieldType(SqlTypeName.DECIMAL);
+  public static final FieldType BOOLEAN = toFieldType(SqlTypeName.BOOLEAN);
+  public static final FieldType CHAR = toFieldType(SqlTypeName.CHAR);
+  public static final FieldType VARCHAR = toFieldType(SqlTypeName.VARCHAR);
 
 Review comment:
   Yea that makes sense. I actually thought you made the comment to remove 
`RowSqlTypes`. I just copied some of these followups from the schema PR. Mostly 
it is the builder to remove, maybe? Or maybe nothing... not actually a huge 
deal for me.
   
   Bigger picture, right now we have:
   
    - Beam types that have metadata
    - No SQL types but a Beam type name can basically store what SQL primitive 
type it is
    - Default mapping of types, no value conversions
   
   A sort of more normal way to set up interactions between type systems would 
be:
   
    - Beam types (may or may not have metadata but don't care)
    - SQL type = wrapped full Beam type (not just type name) + whatever other 
information (not really "meta" per se)
    - Default mapping of Beam type to inject to SQL type and back, value 
conversion possible if needed
   
   The second way has the advantage of being sort of standard coercion style. 
Free if not needed, but easily supports more cases well because SQL primitives 
don't have to be Beam primitives (like datetime w/ timezone) and you can insert 
coercions at exactly the right places because they are clearly different worlds.
   
   So that's maybe further away from this PR too. I also wonder if Calcite's 
type system will allow us to do this using Calcite's types.
   
   I could move all the aliases back out of `CalciteUtils` if you like.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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: 107293)
    Time Spent: 1h  (was: 50m)

> remove RowSqlTypeBuilder
> ------------------------
>
>                 Key: BEAM-4082
>                 URL: https://issues.apache.org/jira/browse/BEAM-4082
>             Project: Beam
>          Issue Type: Sub-task
>          Components: sdk-java-core
>            Reporter: Kenneth Knowles
>            Assignee: Kenneth Knowles
>            Priority: Major
>          Time Spent: 1h
>  Remaining Estimate: 0h
>
> Quoting the PR, this should be removed.



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

Reply via email to