Skip to content

Charts, Samples and Drill to detail fail when an epoch column is DECIMAL or NUMERIC #46666

Backlog

Description

@SEPURI-SAI-KRISHNA

Bug description

A temporal dataset column with a "Datetime format" of epoch_s, epoch_ms or
epoch_us breaks queries when its database type is DECIMAL or NUMERIC.

The driver returns those values as Decimal objects (psycopg2 does for Postgres
NUMERIC), and pandas keeps them in an object column. _process_datetime_column
in superset/utils/core.py applies the epoch unit only to numeric dtypes and
sends anything else to pd.Timestamp, which raises:

{"errors": [{"message": "Cannot convert input [1700000000] of type <class 'decimal.Decimal'> to Timestamp", "error_type": "GENERIC_BACKEND_ERROR", ...}]}

POST /api/v1/chart/data then returns 500 for:

  • a table chart that shows the column, raw or grouped by it
  • native filter values on the column
  • Samples and Drill to detail on the dataset, whatever you drill into, since
    they select every column

The same values in a BIGINT column work.

How to reproduce

  1. In Postgres:

    CREATE TABLE events (name text, ts numeric(18, 0));
    INSERT INTO events VALUES ('a', 1700000000), ('b', 1700086400);
  2. Add events as a dataset. On the ts column, check "Is temporal" and set
    "Datetime format" to epoch_s.

  3. Open the dataset in Explore and look at Samples, or make a table chart that
    shows ts.

Expected behavior

ts shows as 2023-11-14 22:13:20 and 2023-11-15 22:13:20, the same as for a
BIGINT column.

Activity

  1. SEPURI-SAI-KRISHNA commented on Nov 28, 2026

    @SEPURI-SAI-KRISHNA
    ContributorAuthor

    PR: #46667

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions