taosdata / taosdata/TDengine

An error occurred during binary arithmetic operations between the time field and the data field.

Open
#28,339 1 comment 0 reactions 1 assignee View on GitHub

@yu285 is already working on this.

Since Oct 24, 2024.

bug
Dominant language
C
Stars
25.1k
Forks
5k
Avg merge
4d 59m
Merged PRs (30d)
7

Description

Bug Description

An error occurred during binary arithmetic operations between the time field and the data field.

To Reproduce

Assume that we execute the following statement under a database named testdb.

DROP TABLE t1;

CREATE TABLE t1( time TIMESTAMP, c0 INT);
INSERT INTO t1(time, c0) VALUES (1641024000000, 1);

# query 1 success
SELECT time, c0 FROM t1 WHERE (time - c0) > 0;
SELECT time, c0 FROM t1 WHERE (time + c0) > 0;
SELECT time, c0 FROM t1 WHERE (-(-c0)) > 0;

# query 2 error
SELECT time, c0 FROM t1 WHERE (time - (-c0)) > 0;
Expected Behavior

The query statement 1 and query statement 2 can both retrieve all the data.

Actual behaviour

Query 1 can retrieve all the data, but Query 2 returns an error: DB error: Invalid operation.

Environment
  • OS:Ubuntu Server 22.04 LTS 64bit
  • TDengine Version:3.3.3.0
Additional Context

Hello, TDengine team. I'd like to confirm with you whether this is a bug? Because Query 1 and Query 2 are equivalent.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.