dhruv-techdev commented on PR #45435: URL: https://github.com/apache/superset/pull/45435#issuecomment-6331427430
Thanks for the helpful suggestions, @sadpandajoe! I've pushed: 1. **Pinned expression:** a parametrized `test_time_grain_expressions` with an exact-string assertion on `HiveEngineSpec._time_grain_expressions[TimeGrain.WEEK]`, following `test_ibmi.py`. 2. **'u' assumption:** a comment on the `from_unixtime` stand-in noting it assumes Java `SimpleDateFormat` semantics (Monday=1 … Sunday=7), as in Hive 2.x/3.x. I also ran the expression on a live **Hive 2.3.2** (`2.3.2 r857a9fd8ad725a53bd95c1b2d6612f9b1155f44d`), using `scripts/databases/hive/docker-compose.yml`, over 14 days as a `DATE` column: ``` +-------------+----+----------------------+----------------------+ | d | u | old_bucket | new_bucket | +-------------+----+----------------------+----------------------+ | 2025-01-06 | 1 | 2024-12-31 00:00:00 | 2025-01-06 00:00:00 | | 2025-01-07 | 2 | 2025-01-02 00:00:00 | 2025-01-06 00:00:00 | | 2025-01-08 | 3 | 2025-01-04 00:00:00 | 2025-01-06 00:00:00 | | 2025-01-09 | 4 | 2025-01-06 00:00:00 | 2025-01-06 00:00:00 | | 2025-01-10 | 5 | 2025-01-08 00:00:00 | 2025-01-06 00:00:00 | | 2025-01-11 | 6 | 2025-01-10 00:00:00 | 2025-01-06 00:00:00 | | 2025-01-12 | 7 | 2025-01-12 00:00:00 | 2025-01-06 00:00:00 | | 2025-01-13 | 1 | 2025-01-07 00:00:00 | 2025-01-13 00:00:00 | | 2025-01-14 | 2 | 2025-01-09 00:00:00 | 2025-01-13 00:00:00 | | 2025-01-15 | 3 | 2025-01-11 00:00:00 | 2025-01-13 00:00:00 | | 2025-01-16 | 4 | 2025-01-13 00:00:00 | 2025-01-13 00:00:00 | | 2025-01-17 | 5 | 2025-01-15 00:00:00 | 2025-01-13 00:00:00 | | 2025-01-18 | 6 | 2025-01-17 00:00:00 | 2025-01-13 00:00:00 | | 2025-01-19 | 7 | 2025-01-19 00:00:00 | 2025-01-13 00:00:00 | +-------------+----+----------------------+----------------------+ ``` `u` is the ISO day of week (Monday=1 … Sunday=7), confirming the `SimpleDateFormat` assumption. `old_bucket` (the previous expression) gives a different date for each day, and `new_bucket` maps every day to its week's Monday. A `TIMESTAMP` column (`10:30` on each day) also mapped all seven days to `2025-01-06 00:00:00`. While testing I noticed the SQL Lab query in the description passed plain `'yyyy-MM-dd'` strings, which `unix_timestamp()` returns as `NULL` on Hive. I've updated it to use `CAST(d AS DATE)`. I'm happy to look at option 3 (a marked real-Hive test in CI) in a follow-up PR if that would be useful. Please let me know if you'd like anything else changed. Thanks again! -- 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]
