Skip to content

fix(dataset): convert DECIMAL epoch columns with their epoch unit - #46667

Open
SEPURI-SAI-KRISHNA wants to merge 1 commit into
apache:masterfrom
SEPURI-SAI-KRISHNA:fix/decimal-epoch-columns
Open

SEPURI-SAI-KRISHNA wants to merge 1 commit into
apache:masterfrom
SEPURI-SAI-KRISHNA:fix/decimal-epoch-columns

Conversation

@SEPURI-SAI-KRISHNA

Copy link
Copy Markdown
Contributor

SUMMARY

Fixes #46666.

An epoch column stored as DECIMAL or NUMERIC comes back as Decimal
objects in an object column. _process_datetime_column applies the epoch unit
only to numeric dtypes and sends everything else to pd.Timestamp, which raises
TypeError for a Decimal. Any query that returns the column as is fails with
500: a table chart that shows it, filter values on it, and Samples and Drill to
detail on the whole dataset.

An object column holding Decimal values is now turned into numbers first, so
it goes through the same pd.to_datetime(unit=...) call as a BIGINT epoch.
Columns that already come back as timestamps are unchanged.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

POST /api/v1/chart/data with result_type: samples on a DuckDB table with
ts_dec DECIMAL(18,0) and ts_big BIGINT, both epoch_s and holding the same
values:

before: 500 {"errors": [{"message": "Cannot convert input [1700000000] of type <class 'decimal.Decimal'> to Timestamp", ...}]}
after:  200 [{"name": "a", "ts_dec": 1700000000000.0, "ts_big": 1700000000000.0, "amount": 1}, ...]

TESTING INSTRUCTIONS

pytest tests/unit_tests/utils/test_core.py -k decimal_epoch

One case each for epoch_s, epoch_ms and epoch_us, with a null and half a
second in the values. All three fail on master.

ADDITIONAL INFORMATION

An epoch stored as DECIMAL or NUMERIC comes back as Decimal objects,
which pd.Timestamp rejects, so every query that returned the column as
is failed with 500. Turn those values into numbers and convert them like
an integer epoch.
@codeant-ai-for-open-source

Copy link
Copy Markdown
Contributor

CodeAnt  CodeAnt PR Risk

🟢  Low Risk

  • The PR appears safe to merge; no actionable issues were identified in the review.

Assessed commit: a61ade66fbd7

@codecov

codecov Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.23%. Comparing base (9969fe9) to head (a61ade6).

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #46667   +/-   ##
=======================================
  Coverage   86.23%   86.23%           
=======================================
  Files        3146     3146           
  Lines      220018   220021    +3     
  Branches    52110    52111    +1     
=======================================
+ Hits       189725   189730    +5     
+ Misses      26823    26822    -1     
+ Partials     3470     3469    -1     
Flag Coverage Δ
hive 33.63% <50.00%> (-0.01%) ⬇️
mysql 51.83% <50.00%> (-0.01%) ⬇️
postgres 51.85% <50.00%> (-0.01%) ⬇️
presto 35.32% <50.00%> (-0.01%) ⬇️
python 88.81% <100.00%> (+<0.01%) ⬆️
sqlite 51.55% <50.00%> (-0.01%) ⬇️
unit 84.37% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant