Skip to content

Commit 33732c5

Browse files
committed
fix: tests
1 parent 0e75f6a commit 33732c5

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

datafusion/functions/src/datetime/now.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18-
use arrow::array::timezone;
1918
use arrow::datatypes::DataType::Timestamp;
2019
use arrow::datatypes::TimeUnit::Nanosecond;
2120
use arrow::datatypes::{DataType, Field, FieldRef};
@@ -81,7 +80,7 @@ impl ScalarUDFImpl for NowFunc {
8180
fn return_field_from_args(&self, _args: ReturnFieldArgs) -> Result<FieldRef> {
8281
Ok(Field::new(
8382
self.name(),
84-
Timestamp(Nanosecond, Some("+00:00".into())),
83+
Timestamp(Nanosecond, Some("+00".into())),
8584
false,
8685
)
8786
.into())
@@ -113,7 +112,7 @@ impl ScalarUDFImpl for NowFunc {
113112
.config_options
114113
.as_ref()
115114
.map(|opts| opts.execution.time_zone.as_str())
116-
.unwrap_or("+00:00");
115+
.unwrap_or("+00");
117116

118117
Ok(ExprSimplifyResult::Simplified(Expr::Literal(
119118
ScalarValue::TimestampNanosecond(now_ts, Some(timezone.into())),

datafusion/sqllogictest/test_files/timestamps.slt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,16 @@ true
7373
##########
7474
## Current time Tests
7575
##########
76+
statement ok
77+
SET TIME ZONE = '+08'
78+
79+
query T
80+
select arrow_typeof(now());
81+
----
82+
Timestamp(Nanosecond, Some("+08"))
83+
84+
statement ok
85+
SET TIME ZONE = '+00'
7686

7787
query B
7888
select cast(now() as time) = current_time();

0 commit comments

Comments
 (0)