sum12 commented on a change in pull request #771:
URL: https://github.com/apache/arrow-rs/pull/771#discussion_r712003289
##########
File path: arrow/src/compute/kernels/temporal.rs
##########
@@ -22,6 +22,53 @@ use chrono::{Datelike, Timelike};
use crate::array::*;
use crate::datatypes::*;
use crate::error::{ArrowError, Result};
+
+use chrono::format::strftime::StrftimeItems;
+use chrono::format::{parse, Parsed};
+
+macro_rules! extract_component_from_array {
+ ($array:ident, $builder:ident, $extract_fn:ident, $using:ident) => {
+ for i in 0..$array.len() {
+ if $array.is_null(i) {
+ $builder.append_null()?;
+ } else {
+ match $array.$using(i) {
+ Some(dt) => $builder.append_value(dt.$extract_fn() as
i32)?,
+ None => $builder.append_null()?,
+ }
+ }
+ }
+ };
+ ($array:ident, $builder:ident, $extract_fn:ident, $using:ident, $tz:ident,
$parsed:ident) => {
+ match parse(&mut $parsed, $tz, StrftimeItems::new("%z")) {
Review comment:
since `parse` from chrono is being used. The colon (`:`) become
[optional]( https://docs.rs/chrono/0.4.19/src/chrono/format/parse.rs.html#414)
and this differs from the schema. If needed check can be added here.
--
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]