hughhhh opened a new pull request, #45851:
URL: https://github.com/apache/superset/pull/45851

   ### SUMMARY
   
   Two follow-ups to #43870. With `PARTITION_FILTER_MAPPING` on, both made a 
chart return fewer rows than with the flag off, and showed no error.
   
   **Oracle: a typed answer that lost its time of day** 
(https://github.com/apache/superset/pull/43870#discussion_r4387401237)
   
   Use an ISO date-only `NLS_DATE_FORMAT` and map `TO_DATE(:value, 'YYYY-MM-DD 
HH24')` onto an hourly key. A 06:30–18:30 range then returned 0 rows (48 with 
the flag off), and the preview said Valid.
   
   The cause: Oracle refuses the full `'2026-01-12 06:30:00'` text, so the 
typed answer was only checked for being within 367 days of the instant. 
Midnight passes that check, but it's a whole hourly key out.
   
   The same round trip now also asks the transform about the value's day at 
06:00, once as a typed value and once as the text `'2026-01-12 06'`. `TO_DATE` 
reads text shorter than its mask, so any mask with an hour reads it. If the two 
answers differ, the mirror declines with the existing "reads :value 
differently" message. `TRUNC(:value, 'HH')` still mirrors. So does 
`TRUNC(:value)` on a day key under the default format: there every ISO spelling 
is refused, the old within-a-year check still applies, and that path costs one 
more round trip.
   
   **Postgres: raw filter text probed as-is** 
(https://github.com/apache/superset/pull/43870#discussion_r4365591270, 
https://github.com/apache/superset/pull/43870#discussion_r4341450031)
   
   Map a `DATE` column onto a text day key with `CAST(:value AS TEXT)`. Then `d 
== '2026-01-08T00:00:00'`, which drill-by sends at the "Original value" grain, 
returned 0 rows instead of 78. The probe evaluated the transform on the text 
exactly as typed, but the engine compares the instant that text denotes.
   
   A string filter on a temporal column is now probed as its parsed instant: a 
`date` on a days-only column at midnight, otherwise a `datetime`. That also 
fixes the `T`-spelled `TIMESTAMP` equality, `IN` and `>=` cases. A non-ISO 
string on a temporal column now declines instead of being probed verbatim. 
Strings on non-temporal columns are unchanged.
   
   ### TESTING INSTRUCTIONS
   
   - Unit tests: `tests/unit_tests/connectors/sqla/partition_mapping_test.py`, 
`tests/unit_tests/models/partition_mirroring_test.py`.
   - End to end against real Postgres 17 and Oracle 23 Free. Each case compares 
the mirrored row count with the flag-off count:
   
   | Case | master | this PR |
   |---|---|---|
   | PG `DATE` `d == '2026-01-08T00:00:00'` | 0 / 78 | 78 / 78 |
   | PG `DATE` `d == '2026-01-08 00:00:00'` | 0 / 78 | 78 / 78 |
   | PG `DATE` `d IN (T-spelled)` | 0 / 156 | 156 / 156 |
   | PG `DATE` `d >= '2026-01-08T00:00:00'` | 78 / 156 | 156 / 156 |
   | PG `TIMESTAMP` `t == '2026-07-06T10:08:11'` | 0 / 10 | 10 / 10 |
   | PG `TIMESTAMP` `t == '07/06/2026 10:08:11'` | 0 / 10 | 10 / 10 (declines) |
   | Oracle ISO-date NLS, `TO_DATE(:value, 'YYYY-MM-DD HH24')`, 06:30–18:30 | 0 
/ 48, preview Valid | 48 / 48 (declines), preview not valid |
   | Oracle ISO-date NLS, `TRUNC(:value, 'HH')` | 48 / 48 | 48 / 48 (mirrors) |
   | Oracle default NLS, `TRUNC(:value)` day key | 48 / 48 | 48 / 48 (mirrors) |
   
   ### ADDITIONAL INFORMATION
   - [ ] Has associated issue:
   - [ ] Required feature flags: `PARTITION_FILTER_MAPPING`
   - [ ] Changes UI
   - [ ] Includes DB Migration
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   Created with Claude Opus 5.5 in Claude Code.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
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]

Reply via email to