manesioz commented on code in PR #377:
URL: 
https://github.com/apache/doris-spark-connector/pull/377#discussion_r3914965063


##########
spark-doris-connector/spark-doris-connector-base/src/main/java/org/apache/doris/spark/client/read/RowBatch.java:
##########
@@ -424,46 +424,48 @@ public void convertArrowToRowBatch() throws 
DorisException {
                         break;
                     case "DATETIME":
                     case "DATETIMEV2":
-                    case "TIMESTAMPTZ":
-
                         if (mt.equals(MinorType.VARCHAR)) {
-                            VarCharVector varCharVector = (VarCharVector) 
curFieldVector;
-                            for (int rowIndex = 0; rowIndex < 
rowCountInOneBatch; rowIndex++) {
-                                if (varCharVector.isNull(rowIndex)) {
-                                    addValueToRow(rowIndex, null);
-                                    continue;
-                                }
-                                String stringValue = completeMilliseconds(new 
String(varCharVector.get(rowIndex),
-                                        StandardCharsets.UTF_8));
-                                LocalDateTime dateTime = 
LocalDateTime.parse(stringValue, dateTimeV2Formatter);
-                                if (datetimeJava8ApiEnabled) {
-                                    Instant instant = 
dateTime.atZone(DEFAULT_ZONE_ID).toInstant();
-                                    addValueToRow(rowIndex, instant);
-                                } else {
-                                    addValueToRow(rowIndex, 
Timestamp.valueOf(dateTime));
-                                }
-                            }
+                            convertVarcharDateTime((VarCharVector) 
curFieldVector);
                         } else if (curFieldVector instanceof TimeStampVector) {
                             TimeStampVector timeStampVector = 
(TimeStampVector) curFieldVector;
+                            ArrowType.Timestamp timestampType =
+                                    (ArrowType.Timestamp) 
timeStampVector.getField().getType();
+                            String timezone = timestampType.getTimezone();
+                            ZoneId zoneId = timezone == null ? null : 
ZoneId.of(timezone);

Review Comment:
   Yeah, I was a bit worried about this aspect. Also I think Java maps CST to 
America/Chicago instead of Asia/Shanghai (who said [timezones were 
easy](https://xkcd.com/1883/)!) so I'll follow [the mappings set in 
Doris](https://github.com/apache/doris/blob/master/fe/fe-core/src/main/java/org/apache/doris/common/util/TimeUtils.java#L106-L117).
 



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to