Riya-Suthar1 opened a new pull request, #45041: URL: https://github.com/apache/superset/pull/45041
### SUMMARY DuckDB epoch timestamp columns generate `datetime(..., 'unixepoch')`, a SQLite function that DuckDB does not implement. Queries using `epoch_s`, `epoch_ms`, or `epoch_us` consequently fail with a `CatalogException`. Replace that expression with DuckDB timestamp/interval arithmetic. The result is a timezone-naive UTC timestamp, so applying a time grain does not move buckets when the connection timezone changes. Add 12 parameterized regression cases that compile the complete query with SQLAlchemy and execute it against an in-process DuckDB database: seconds, milliseconds, microseconds, negative timestamps, NULLs, and daily truncation, each under UTC and America/New_York. ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF Backend SQL change; no UI changes. Before: ```sql SELECT datetime(0, 'unixepoch'); -- CatalogException: Scalar Function with name datetime does not exist! ``` After: ```sql SELECT (TIMESTAMP 'epoch' + 0 * INTERVAL '1 second'); -- 1970-01-01 00:00:00 ``` ### TESTING INSTRUCTIONS ```bash pytest tests/unit_tests/db_engine_specs/test_duckdb.py -q pre-commit run pylint --rcfile=.pylintrc --load-plugins=superset.extensions.pylint --reports=no superset/db_engine_specs/duckdb.py ``` Local results: **29 tests passed**; all applicable staged-file pre-commit checks passed; the explicit backend pylint check passed. The new epoch cases reproduced the unsupported-function error before the fix. Environment: master `f3da949f61cc1f9e640b36ae14a136be405c4010`, Python 3.12.14, DuckDB 1.5.6, duckdb-engine 0.17.0, SQLAlchemy 2.0.52. Full application/UI testing was not performed. ### ADDITIONAL INFORMATION Prepared with AI assistance; the reproduction, regression tests, and checks above were executed locally. - [ ] Has associated issue: - [ ] Required feature flags: - [ ] Changes UI - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351)) - [ ] Migration is atomic, supports rollback & is backwards-compatible - [ ] Confirm DB migration upgrade and downgrade tested - [ ] Runtime estimates and downtime expectations provided - [ ] Introduces new feature or API - [ ] Removes existing feature or API -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
