Skip to content

Support Decimal256 #377

Open

Description

@thomasj02

Clickhouse supports Decimal256, with precision up to 76 (https://clickhouse.com/docs/en/sql-reference/data-types/decimal). However, clickhouse-cpp only supports up to Decimal128.

Abseil doesn't have an int256, but boost::multiprecision does (https://www.boost.org/doc/libs/1_85_0/libs/multiprecision/doc/html/boost_multiprecision/tut/ints/cpp_int.html). There are many other int256 implementations available online, and clang has support for _BitInt(256)

Activity

  1. monkeyboiii commented on Jun 11, 2025

    @monkeyboiii

    Second this

  2. polyglotAI-bot commented on Nov 18, 2026

    @polyglotAI-bot
    Collaborator

    Recommendation: Keep open — maintainer decision
    Decimal256 needs a 256-bit value type, and the library has none. A maintainer decides on that design; until then, the client should reject a precision over 38 with a clear error, because today it misreads the data.

    Analysis: The type parser accepts the server type Decimal(76, S) as Decimal (clickhouse/types/type_parser.cpp:72-75), ColumnDecimal stores every precision above 18 in a ColumnInt128 (clickhouse/columns/decimal.cpp:67-73), and the precision check is only a TODO (clickhouse/types/types.cpp:320). A Decimal(39..76, S) value has 32 bytes on the wire, so Select() reads half of each value, gives wrong values, then fails with an error that does not name the type. Insert() sends 16 bytes for each value, so the insert fails at the server receive timeout (300 s).

    Automated triage by Polyglot AI. A maintainer makes the final decision. Shortened on 2026-11-20: the edit history has the first version.

  3. added
    data-typesArea: type names, value encoding and decoding, row mapping, data formats
    on Nov 19, 2026
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

    data-typesArea: type names, value encoding and decoding, row mapping, data formatsenhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions