apache / apache/doris

[Bug] ArrowFlight SQL result automatically converts timezone naive date to UTC (which is wrong)

Open
#65,741 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
15.9k
Forks
3.9k
Avg merge
2d 23h
Merged PRs (30d)
520

Description

### Search before asking

- [x] I had searched in the [issues](https://github.com/apache/doris/issues?q=is%3Aissue) and found no similar issues.

### Version

When using arrow to execute sql:
SELECT CAST('2026-07-02 01:36:22.069504' AS DATETIME(6)) AS ts

### What's Wrong?

The result is automatically converted to UTC.
2026-07-02 01:36:22.069504+00:00

### What You Expected?

The result sould be
2026-07-02 01:36:22.069504

This is the wrong assumption. the original timestamp might be local timezone timestamp.

### How to Reproduce?

Execute
SELECT CAST('2026-07-02 01:36:22.069504' AS DATETIME(6)) AS ts

in python:
import adbc_driver_flightsql.dbapi as flightsql
from adbc_driver_manager import DatabaseOptions
from q_secrets import get_connection_details

details = get_connection_details("doris", flightsql=True)
connection = flightsql.connect(
uri=f"{details['driver']}://{details['hostname']}:{details['port']}",
db_kwargs={
DatabaseOptions.USERNAME.value: details["username"],
DatabaseOptions.PASSWORD.value: details["pwd"],
},
)

with connection.cursor() as cursor:
cursor.execute("SELECT CAST('2026-07-02 01:36:22.069504' AS DATETIME(6)) AS ts")
table = cursor.fetch_arrow_table()

field = table.schema.field("ts")
print("Arrow field:", field)
print("Field metadata:", field.metadata)
print("Value:", table["ts"].to_pylist())

connection.close()

### Anything Else?

_No response_

### Are you willing to submit PR?

- [ ] Yes I am willing to submit a PR!

### Code of Conduct

- [x] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)

Contributor guide

Open the contributing guide

Research direction

Start by running the provided Python Arrow Flight SQL reproduction with the DATETIME(6) query, then inspect the Arrow field metadata and value shown in the issue. Trace where the timezone-naive result is converted to UTC; done means the value remains 2026-07-02 01:36:22.069504 without a UTC offset.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, sql
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.