Skip to content

Commit

Permalink
fix failed test
Browse files Browse the repository at this point in the history
  • Loading branch information
Lordworms committed Apr 9, 2024
1 parent 026c03a commit 58dfbb3
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions arrow-cast/src/cast/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1598,8 +1598,8 @@ pub fn cast_with_options(
0
};
let array = array
.as_primitive::<TimestampMillisecondType>()
.try_unary::<_, TimestampMillisecondType, ArrowError>(|x| {
.as_primitive::<TimestampMicrosecondType>()
.try_unary::<_, TimestampMicrosecondType, ArrowError>(|x| {
Ok(x + MICROSECONDS * offset)
})?;
let array = cast_with_options(&array, &Int64, cast_options)?;
Expand Down Expand Up @@ -1654,8 +1654,8 @@ pub fn cast_with_options(
0
};
let array = array
.as_primitive::<TimestampMillisecondType>()
.try_unary::<_, TimestampMillisecondType, ArrowError>(|x| Ok(offset + x))?;
.as_primitive::<TimestampSecondType>()
.try_unary::<_, TimestampSecondType, ArrowError>(|x| Ok(offset + x))?;
let array = cast_with_options(&array, &Int64, cast_options)?;
let time_array = array.as_primitive::<Int64Type>();
let from_size = SECONDS_IN_DAY;
Expand All @@ -1680,8 +1680,8 @@ pub fn cast_with_options(
0
};
let array = array
.as_primitive::<TimestampMillisecondType>()
.try_unary::<_, TimestampMillisecondType, ArrowError>(|x| {
.as_primitive::<TimestampNanosecondType>()
.try_unary::<_, TimestampNanosecondType, ArrowError>(|x| {
Ok(x + offset * NANOSECONDS)
})?;
let array = cast_with_options(&array, &Int64, cast_options)?;
Expand Down Expand Up @@ -8574,8 +8574,10 @@ mod tests {

for dt in data_types {
assert_eq!(
cast_with_options(&array, &dt, &cast_options).unwrap_err().to_string(),
"Parser error: Invalid timezone \"ZZTOP\": only offset based timezones supported without chrono-tz feature"
cast_with_options(&array, &dt, &cast_options)
.unwrap_err()
.to_string(),
"Parser error: Invalid timezone \"ZZTOP\": failed to parse timezone"
);
}
}
Expand Down

0 comments on commit 58dfbb3

Please sign in to comment.