Skip to content

[Bug]: TIME arithmetic returns wrong values and result metadata for multiplication, division, and modulo #28953

Closed

Description

@XuPeng-SH

CI evidence

The failure appears in unrelated PR branches:

Reproduction

The failing fixture is test/distributed/cases/dtype/time.test:

CREATE TABLE t1(t TIME(3));
INSERT INTO t1 VALUES (0.001), (34.5);

SELECT t * 10 FROM t1;
SELECT t / 10 FROM t1;
SELECT t % 5 FROM t1;

Expected values from the fixture:

t * 10   -> 0.010, 345.000
t / 10   -> 0.000100000, 3.450000000
t % 5    -> 0.001, 4.500

Observed BVT values include:

t * 10   -> 0.000
t / 10   -> 0E-9
t % 5    -> 0.000

The BVT also reports a result metadata mismatch: the fixture expects the previous string-like result contract while execution returns a DECIMAL result.

Expected behavior

TIME arithmetic should preserve the documented value semantics, scale/format, and stable result metadata for *, /, and %. The behavior should be consistent across ordinary and prepared/runtime expression paths.

Attribution

Neither the decimal-literal PR (#28825) nor the spatial-distance PR (#28830) modifies the TIME arithmetic implementation. This is a base/shared temporal arithmetic or result-coercion regression.

Related #25705 and #27088 track broader numeric/coercion work but explicitly do not cover this temporal arithmetic manifestation. #28465 is an OCT/TIME parsing issue and is also distinct.

Activity

  1. self-assigned this
    on Sep 15, 2026
  2. added
    kind/bug
    on Sep 15, 2026
  3. XuPeng-SH commented on Sep 16, 2026

    @XuPeng-SH
    ContributorAuthor

    Correction to the original attribution in this issue: the clean CI failure 34937495318 / job 104280571311 ran PR #28825 head 7df20be7d3184b723d416bed709b1be5adec9091. That PR's normalizePlainDecimalLiteral rewrites the numeric literal 0.001 to .001; the string-to-TIME parser returns zero for that spelling before applying the fraction. Therefore the observed failure is not evidence of a current-base TIME arithmetic kernel regression.

    PR #28957 has been updated to add a planner-boundary regression guard and explicit client-visible DECIMAL metadata assertions to the existing BVT. The separate prepared expression failure (TIME * ? being typed as TIME TEXT) remains a distinct issue until it has its own design and reproduction coverage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions