You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datafusion.apache.org by co...@apache.org on 2026/05/15 22:30:13 UTC
(datafusion-comet) branch main updated: feat: support current timezone (#4348)
This is an automated email from the ASF dual-hosted git repository.
comphead pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion-comet.git
The following commit(s) were added to refs/heads/main by this push:
new 323b6d731 feat: support current timezone (#4348)
323b6d731 is described below
commit 323b6d7313d466dc3da7525d6234c199c677eb9e
Author: Bolin Lin <li...@gmail.com>
AuthorDate: Fri May 15 18:30:07 2026 -0400
feat: support current timezone (#4348)
---
.../contributor-guide/spark_expressions_support.md | 2 +-
docs/source/user-guide/latest/expressions.md | 1 +
.../expressions/datetime/current_timezone.sql | 40 ++++++++++++++++++++++
3 files changed, 42 insertions(+), 1 deletion(-)
diff --git a/docs/source/contributor-guide/spark_expressions_support.md b/docs/source/contributor-guide/spark_expressions_support.md
index 22ab486cc..07e6ac96e 100644
--- a/docs/source/contributor-guide/spark_expressions_support.md
+++ b/docs/source/contributor-guide/spark_expressions_support.md
@@ -220,7 +220,7 @@
- [ ] current_date
- [ ] current_time
- [ ] current_timestamp
-- [ ] current_timezone
+- [x] current_timezone
- [x] date_add
- [x] date_diff
- [x] date_format
diff --git a/docs/source/user-guide/latest/expressions.md b/docs/source/user-guide/latest/expressions.md
index 818f379a4..096162331 100644
--- a/docs/source/user-guide/latest/expressions.md
+++ b/docs/source/user-guide/latest/expressions.md
@@ -101,6 +101,7 @@ of expressions that be disabled.
| Expression | SQL |
| ---------------- | ---------------------------- |
+| CurrentTimeZone | `current_timezone` |
| DateAdd | `date_add` |
| DateDiff | `datediff` |
| DateFormat | `date_format` |
diff --git a/spark/src/test/resources/sql-tests/expressions/datetime/current_timezone.sql b/spark/src/test/resources/sql-tests/expressions/datetime/current_timezone.sql
new file mode 100644
index 000000000..e5ca98f10
--- /dev/null
+++ b/spark/src/test/resources/sql-tests/expressions/datetime/current_timezone.sql
@@ -0,0 +1,40 @@
+-- Licensed to the Apache Software Foundation (ASF) under one
+-- or more contributor license agreements. See the NOTICE file
+-- distributed with this work for additional information
+-- regarding copyright ownership. The ASF licenses this file
+-- to you under the Apache License, Version 2.0 (the
+-- "License"); you may not use this file except in compliance
+-- with the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing,
+-- software distributed under the License is distributed on an
+-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+-- KIND, either express or implied. See the License for the
+-- specific language governing permissions and limitations
+-- under the License.
+
+statement
+CREATE TABLE test_current_timezone(id INT) USING parquet
+
+statement
+INSERT INTO test_current_timezone VALUES (1), (2), (3), (4), (NULL)
+
+query
+SELECT current_timezone()
+
+query
+SELECT current_timezone() IS NOT NULL
+
+query
+SELECT current_timezone() = current_timezone()
+
+query
+SELECT length(current_timezone()) > 0
+
+query
+SELECT id, current_timezone() IS NOT NULL FROM test_current_timezone
+
+query
+SELECT id FROM test_current_timezone WHERE current_timezone() = current_timezone()
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datafusion.apache.org
For additional commands, e-mail: commits-help@datafusion.apache.org