Copilot commented on code in PR #2156:
URL: https://github.com/apache/auron/pull/2156#discussion_r3032030135
##########
spark-extension-shims-spark/src/test/scala/org/apache/auron/AuronFunctionSuite.scala:
##########
@@ -144,6 +144,28 @@ class AuronFunctionSuite extends AuronQueryTest with
BaseAuronSQLSuite {
}
}
+ test("date-part functions with non-UTC timezone") {
+ withSQLConf(SQLConf.SESSION_LOCAL_TIMEZONE.key -> "America/New_York") {
+ withTable("t1") {
+ sql("create table t1(c1 timestamp) using parquet")
+ sql("insert into t1 values(timestamp'2021-01-04 04:30:00')")
Review Comment:
This test likely doesn’t exercise the reported boundary-crossing bug: the
timestamp literal `timestamp'2021-01-04 04:30:00'` is parsed using the current
`SESSION_LOCAL_TIMEZONE` (America/New_York here), so it represents a local
04:30 value rather than a fixed 04:30 UTC instant. Consider constructing the
stored value as a known UTC instant (e.g., insert under UTC then query under
America/New_York, or insert via an explicit UTC conversion) so the expected
day/month/year can differ across timezones and the regression is actually
detected.
```suggestion
withTable("t1") {
sql("create table t1(c1 timestamp) using parquet")
withSQLConf(SQLConf.SESSION_LOCAL_TIMEZONE.key -> "UTC") {
sql("insert into t1 values(timestamp'2021-01-04 04:30:00')")
}
withSQLConf(SQLConf.SESSION_LOCAL_TIMEZONE.key -> "America/New_York") {
```
##########
native-engine/datafusion-ext-functions/src/spark_dates.rs:
##########
@@ -28,40 +28,101 @@ use datafusion::{
};
use datafusion_ext_commons::arrow::cast::cast;
-// ---- date parts on Date32 via Arrow's date_part
-// -----------------------------------------------
+fn parse_tz(args: &[ColumnarValue]) -> Option<Tz> {
+ if args.len() < 2 {
+ return None;
+ }
+ match &args[1] {
+ ColumnarValue::Scalar(ScalarValue::Utf8(Some(s))) =>
s.parse::<Tz>().ok(),
+ _ => None,
Review Comment:
This file imports `chrono::prelude::*` (near the top) but nothing in this
module appears to use it. With `clippy -D warnings` in CI, an unused import
will fail the build; please remove the unused `prelude::*` import (or replace
with a specific item if needed).
--
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]