geido commented on code in PR #43870:
URL: https://github.com/apache/superset/pull/43870#discussion_r4363300690


##########
superset/datasets/api.py:
##########
@@ -2064,6 +2165,134 @@ def get(self, id_or_uuid: str, **kwargs: Any) -> 
Response:
             entity_concurrency_token(SqlaTable, table.id, table.uuid),
         )
 
+    @expose("/<int:pk>/partition_mapping/preview/", methods=("POST",))
+    @protect()
+    @safe
+    @statsd_metrics
+    @event_logger.log_this_with_context(
+        action=lambda self, *args, **kwargs: (
+            f"{self.__class__.__name__}.partition_mapping_preview"
+        ),
+        log_to_statsd=False,
+    )
+    def partition_mapping_preview(self, pk: int) -> Response:

Review Comment:
   Not sure, but on Oracle the preview and the chart pass `:value` as different 
types: the preview sends a string, a chart's time range sends a typed 
`TO_DATE(...)`. So `TO_DATE(:value, 'YYYY-MM-DD HH24:MI:SS')` previews Valid, 
yet with the default `NLS_DATE_FORMAT` the bounds land in year 0012 and the 
chart returns 0 rows. Could the preview probe with the same typed values the 
chart path uses?
   
   ![Oracle: TO_DATE(:value, fmt) previews Valid; the chart's PART bounds land 
in year 0012 and it returns no rows, flag off returns 
48](https://gist.githubusercontent.com/geido/2e9a0de274464f8bac4b8ac43e8888e9/raw/bug4b-oracle-preview-drift.gif)
   
[mp4](https://gist.githubusercontent.com/geido/2e9a0de274464f8bac4b8ac43e8888e9/raw/bug4b-oracle-preview-drift.mp4)



##########
superset/db_engine_specs/oracle.py:
##########
@@ -36,6 +36,7 @@
 class OracleEngineSpec(BaseEngineSpec):
     engine = "oracle"
     engine_name = "Oracle"
+    select_without_from_suffix = " FROM DUAL"

Review Comment:
   I think the new temporal literal path drops the time on Oracle. Its `DATE` 
keeps the time of day but maps to `sa.Date`, so `holds_days_only` skips the 
precision check and the bound becomes `TO_DATE('2026-01-12', 'YYYY-MM-DD')`. 
With `CAST(:value AS DATE)` (preview Valid), a 06:30 to 18:30 range returns 0 
rows instead of 48. Could the exemption skip Oracle, whose dialect `DATE` is a 
`DateTime`?
   
   ![Oracle: CAST(:value AS DATE) previews Valid; this head returns no rows, 
a118bb3 and flag off return 
48](https://gist.githubusercontent.com/geido/2e9a0de274464f8bac4b8ac43e8888e9/raw/bug4a-oracle-date-floor.gif)
   
[mp4](https://gist.githubusercontent.com/geido/2e9a0de274464f8bac4b8ac43e8888e9/raw/bug4a-oracle-date-floor.mp4)



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