Skip to content

Bug in MAX Function with MergeTree Engine #403

Open

Description

@starbarry

Dear CK Team, I have a bug that I need to report to you.

Description:
While using the MAX/MIN function on a column with MergeTree table engine, the query produces inconsistent results. Specifically, this bug is triggered when a specific partition key is selected and the corresponding column contains NaN values

Steps to Reproduce:

CREATE TABLE t1 (c0 Int32) 
ENGINE = MergeTree() 
ORDER BY c0
PARTITION BY (toUInt64 (c0))

INSERT INTO t1 (c0) 
VALUES (-766544500), (2052205600), (2064494500), (824848640), (0)

SELECT MAX(-(c0/c0/c0+c0)) 
FROM t1

Expected Behavior:
The result should be consistent and return the unique positive value 766544500.

Actual Behavior:
Different values are returned across multiple queries, including all values in c0 execpt NaN ( -766544500, 2052205600, 2064494500, 824848640, 0).

Environment
OS:Ubuntu Server 22.04 LTS 64bit
TDengine Version:24.5.1.1010 (official build)

Activity

  1. added
    bugSomething isn't working
    on Jul 21, 2025
  2. laeg commented on Jul 21, 2025

    @laeg
    Contributor

    @starbarry can you check this is still applicable with the latest version of ClickHouse please

  3. added
    need-infoAwaiting extra info from community/issue creator
    on Jul 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneed-infoAwaiting extra info from community/issue creator

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions