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

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

                Author: ASF GitHub Bot
            Created on: 22/Feb/19 22:23
            Start Date: 22/Feb/19 22:23
    Worklog Time Spent: 10m 
      Work Description: apilloud commented on pull request #7865: [BEAM-6701] 
Add logical types to schema
URL: https://github.com/apache/beam/pull/7865#discussion_r259530404
 
 

 ##########
 File path: 
sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/rel/BeamCalcRel.java
 ##########
 @@ -363,24 +374,31 @@ public Expression field(BlockBuilder list, int index, 
Type storageType) {
             Expressions.call(expression, "getValue", 
Expressions.constant(index)), Object.class);
       }
       FieldType fromType = inputSchema.getField(index).getType();
-      String getter = typeGetterMap.get(fromType.getTypeName());
+      String getter;
+      if (fromType.getTypeName().isLogicalType()) {
+        getter = 
logicalTypeGetterMap.get(fromType.getLogicalType().getIdentifier());
+      } else {
+        getter = typeGetterMap.get(fromType.getTypeName());
+      }
       if (getter == null) {
         throw new IllegalArgumentException("Unable to get " + 
fromType.getTypeName());
       }
-
       Expression field = Expressions.call(expression, getter, 
Expressions.constant(index));
-      if (fromType.getTypeName().isDateType()) {
+      if (fromType.getTypeName().isLogicalType()) {
         field = Expressions.call(field, "getMillis");
 
 Review comment:
   This isn't going to work on just any `LogicalType` only `DateType`. 
Something is broken here.
 
----------------------------------------------------------------
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: 202909)
    Time Spent: 3h 40m  (was: 3.5h)

> Create LogicalType for Schema fields
> ------------------------------------
>
>                 Key: BEAM-6701
>                 URL: https://issues.apache.org/jira/browse/BEAM-6701
>             Project: Beam
>          Issue Type: Sub-task
>          Components: sdk-java-core
>            Reporter: Reuven Lax
>            Assignee: Reuven Lax
>            Priority: Major
>          Time Spent: 3h 40m
>  Remaining Estimate: 0h
>
> This will allow users to create their own logical types to store in schema 
> fields, backed by one of the fundamental schema field types. Today SQL hacks 
> on top of the field metadata to distinguish its types. LogicalTypes would 
> allow for a more principled way of doing this.



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

Reply via email to