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


##########
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:
   I think thats a cleaner approach and makes the timestamptz case more 
explicit, will change, thank you!



-- 
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