matrixorigin / matrixorigin/matrixone

[Compatibility]: ADDTIME returns NULL for valid negative composite time expressions

Open
#28,150 0 comments 0 reactions 1 assignee Claimed by @jiangxinmeng1 View on GitHub
kind/bug needs-triage
Dominant language
Go
Stars
1.9k
Forks
311
Avg merge
1d 3h
Merged PRs (30d)
768

Description

## 现象

在 MatrixOne main `99ed717b769e261b842c2f17345bd65865fc1470`,`ADDTIME()` 无法处理合法的负复合时间表达式:

```sql
SELECT ADDTIME(
'2024-01-31 23:59:59.123456',
'-1 02:03:04.500000');
-- NULL
```

相同日期时间和正值表达式可得到 `2024-02-02 02:03:03.623456`;`SUBTIME(datetime, '1 02:03:04.500000')` 也可正常计算,问题集中在 `ADDTIME` 的负复合表达式解析。

## 期望

`ADDTIME` 应支持带符号的复合时间表达式,并按负值执行减法,不能静默返回 `NULL`。

## 影响

依赖带符号持续时间的账期、时间差和 ETL 表达式会丢失结果。

## 复现信息

- MatrixOne main: `99ed717b769e261b842c2f17345bd65865fc1470`
- 重复执行 3 次,结果一致

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.