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

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

                Author: ASF GitHub Bot
            Created on: 25/Apr/19 17:18
            Start Date: 25/Apr/19 17:18
    Worklog Time Spent: 10m 
      Work Description: bmv126 commented on pull request #8376: 
[BEAM-7130]Support Datetime value conversion in convertAvroFieldStrict
URL: https://github.com/apache/beam/pull/8376#discussion_r278650481
 
 

 ##########
 File path: 
sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/utils/AvroUtils.java
 ##########
 @@ -669,7 +670,11 @@ public static Object convertAvroFieldStrict(
                 .fromBytes(byteBuffer.duplicate(), type.type, logicalType);
         return convertDecimal(bigDecimal, fieldType);
       } else if (logicalType instanceof LogicalTypes.TimestampMillis) {
-        return convertDateTimeStrict((Long) value, fieldType);
+        if (value instanceof DateTime) {
+          return convertDateTimeStrict(((DateTime) value).getMillis(), 
fieldType);
 
 Review comment:
   As the TimestampConversion is set in a static initialization block, the 
expectation of the initial code is to covert long to JodaTime during 
deserialization.  So with that expectation the else part will not be needed in 
this case.
   
   Also how are the other logical-types of Avro handled when converting to Row ?
 
----------------------------------------------------------------
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: 232989)
            Time Spent: 10m
    Remaining Estimate: 0h

> convertAvroFieldStrict as public static function could handle more types of 
> value for logical type timestamp-millis
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: BEAM-7130
>                 URL: https://issues.apache.org/jira/browse/BEAM-7130
>             Project: Beam
>          Issue Type: Improvement
>          Components: sdk-java-core
>            Reporter: Rui Wang
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> https://lists.apache.org/thread.html/68322dcf9418b1d1640273f1a58f70874b61b4996d08dd982b29492c@%3Cdev.beam.apache.org%3E



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

Reply via email to