Commit bfc54ca
committed
Remove DatetimeOutputCastRule on the analytics-engine route (#5420)
## Problem
On the analytics-engine route, every datetime root column is wrapped in
`CAST(<DATE/TIME/TIMESTAMP> AS VARCHAR)` by `DatetimeOutputCastRule`.
A matching `DatetimeOutputCastRewriter` on the engine side then translates
that cast into DataFusion's `to_char` extension. Whenever the rewriter's
format string and the PPL formatter disagree (e.g. trailing `Z`, `T`
separator), users see wire-format divergence — issue #5420.
## Solution
Drop the cast rule and let the engine return real datetime cells.
The PPL response pipeline already handles datetime → string conversion
natively at the formatter layer:
- `AnalyticsExecutionEngine.convertRows` feeds engine cells
(`LocalDateTime` / `LocalDate` / `LocalTime`) through
`ExprValueUtils.fromObjectValue`, which produces
`ExprTimestampValue` / `ExprDateValue` / `ExprTimeValue`.
- Their `value()` methods render the documented PPL space-separated
format (`yyyy-MM-dd HH:mm:ss[.SSSSSSSSS]` etc.).
The companion change in `opensearch-project/OpenSearch` removes the
matching `DatetimeOutputCastRewriter` and its callsites.
## Changes
- Delete `DatetimeOutputCastRule`.
- Drop the unused `UdtMapping.isDatetimeType` helper.
- Rewrite the four cast-shape assertions in `DatetimeExtensionTest`
to assert the post-removal RelNode (no `CAST(... VARCHAR)` wrapper,
schema reports `DATE` / `TIME` / `TIMESTAMP`).
Signed-off-by: Eric Wei <ericwei@amazon.com>1 parent 817f7f3 commit bfc54ca
3 files changed
Lines changed: 14 additions & 87 deletions
File tree
- api/src
- main/java/org/opensearch/sql/api/spec/datetime
- test/java/org/opensearch/sql/api/spec/datetime
Lines changed: 1 addition & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | 47 | | |
53 | 48 | | |
Lines changed: 0 additions & 62 deletions
This file was deleted.
Lines changed: 13 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
| 66 | + | |
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
76 | | - | |
77 | | - | |
| 75 | + | |
| 76 | + | |
78 | 77 | | |
79 | 78 | | |
80 | 79 | | |
| |||
94 | 93 | | |
95 | 94 | | |
96 | 95 | | |
97 | | - | |
| 96 | + | |
98 | 97 | | |
99 | 98 | | |
100 | 99 | | |
101 | | - | |
102 | | - | |
103 | | - | |
| 100 | + | |
| 101 | + | |
104 | 102 | | |
105 | 103 | | |
106 | 104 | | |
| |||
134 | 132 | | |
135 | 133 | | |
136 | 134 | | |
137 | | - | |
| 135 | + | |
138 | 136 | | |
139 | 137 | | |
140 | 138 | | |
141 | | - | |
142 | | - | |
143 | | - | |
| 139 | + | |
| 140 | + | |
144 | 141 | | |
145 | 142 | | |
146 | 143 | | |
| |||
155 | 152 | | |
156 | 153 | | |
157 | 154 | | |
158 | | - | |
| 155 | + | |
159 | 156 | | |
160 | 157 | | |
161 | 158 | | |
162 | 159 | | |
163 | 160 | | |
164 | 161 | | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
171 | 165 | | |
172 | 166 | | |
173 | 167 | | |
0 commit comments