You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/03/29 16:25:27 UTC

[GitHub] [arrow-datafusion] alamb commented on a change in pull request #2120: Serialize timezone in timestamp scalar values

alamb commented on a change in pull request #2120:
URL: https://github.com/apache/arrow-datafusion/pull/2120#discussion_r837671980



##########
File path: datafusion/proto/src/from_proto.rs
##########
@@ -581,12 +575,30 @@ impl TryFrom<&protobuf::scalar_value::Value> for ScalarValue {
                 )
             }
             Value::Date64Value(v) => ScalarValue::Date64(Some(*v)),
-            Value::TimeSecondValue(v) => ScalarValue::TimestampSecond(Some(*v), None),
-            Value::TimeMillisecondValue(v) => {
-                ScalarValue::TimestampMillisecond(Some(*v), None)
-            }
             Value::IntervalYearmonthValue(v) => ScalarValue::IntervalYearMonth(Some(*v)),
             Value::IntervalDaytimeValue(v) => ScalarValue::IntervalDayTime(Some(*v)),
+            Value::TimestampValue(v) => {
+                let ts_value = v.value.as_ref().ok_or(Error::required("value"))?;
+                let timezone = if v.timezone.is_empty() {
+                    None
+                } else {
+                    Some(v.timezone.clone())
+                };

Review comment:
       Maybe it could be written like this:
   ```suggestion
                   let timezone = v.timezone.map(|v| Some(v.clone()))?
   ```

##########
File path: datafusion/proto/src/from_proto.rs
##########
@@ -829,10 +839,32 @@ impl TryFrom<&protobuf::ScalarValue> for ScalarValue {
                 )
             }
             Value::Date64Value(v) => Self::Date64(Some(*v)),
-            Value::TimeSecondValue(v) => Self::TimestampSecond(Some(*v), None),
-            Value::TimeMillisecondValue(v) => Self::TimestampMillisecond(Some(*v), None),
             Value::IntervalYearmonthValue(v) => Self::IntervalYearMonth(Some(*v)),
             Value::IntervalDaytimeValue(v) => Self::IntervalDayTime(Some(*v)),
+            Value::TimestampValue(v) => {

Review comment:
       the replication is unfortunate but I see it is not something that got introduced with this PR




-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org