Commit 072496c
committed
Fix: consider interval's precision. Allow non-aligned period values as interval encoding (#148)
* add the precision value to the interval types
The interval types with a seconds component have the seconds
precision as a property. With this commit the driver will read the
Datetime(/Timestamp) scale and use that as precision for the interval
with seconds component data type property, attached to the .precision
field of the records.
* fix: use IRD as precision src. instead of ARD
When handling values received from ES/SQL, use the IRD descriptor
instead of the ARD, when reading data characteristics (like the
precision).
Also, change the integration tests that were setting ARD fields - like
precision - on string conversions. (This is wrong since the strings
don't have a precision property, so the driver should not - and now will
not - take this property into account.)
* fix: decouple ES period format from interval type
ES/SQL transmits interval values in a ISO8601 period value. An
interval-to-period 1:1 mapping is possible, however ES/SQL doesn't
adhere to this mapping. For instance:
- instead of `P1DT1H` for `INTERVAL '1 1' DAY TO HOUR`, ES/SQL will send
`PT25H` (which in a 1:1 mapping would be `INTERVAL '25' HOUR` literal,
equivalent, but different from the original);
- `INTERVAL '61:59' MINUTE TO SECOND` is encoded as `PT1H1M59S` instead
of `PT61M59S`;
- `INTERVAL '61' SECOND` is transmitted as `PT1M1S` vs. `PT61S`.
Because of this, the driver will now detect the mapping misalignment,
convert any interval in the "day/to/second" range to seconds and
re-calculate the values for the corresponding interval members from
that.
(cherry picked from commit 0366a74)1 parent a6cfca5 commit 072496c
File tree
5 files changed
+160
-50
lines changed- driver
- test
5 files changed
+160
-50
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2118 | 2118 | | |
2119 | 2119 | | |
2120 | 2120 | | |
2121 | | - | |
| 2121 | + | |
2122 | 2122 | | |
2123 | 2123 | | |
2124 | 2124 | | |
| |||
2151 | 2151 | | |
2152 | 2152 | | |
2153 | 2153 | | |
| 2154 | + | |
2154 | 2155 | | |
2155 | 2156 | | |
2156 | 2157 | | |
| |||
2233 | 2234 | | |
2234 | 2235 | | |
2235 | 2236 | | |
| 2237 | + | |
| 2238 | + | |
| 2239 | + | |
| 2240 | + | |
| 2241 | + | |
| 2242 | + | |
| 2243 | + | |
| 2244 | + | |
| 2245 | + | |
| 2246 | + | |
| 2247 | + | |
| 2248 | + | |
| 2249 | + | |
| 2250 | + | |
2236 | 2251 | | |
2237 | 2252 | | |
2238 | 2253 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2004 | 2004 | | |
2005 | 2005 | | |
2006 | 2006 | | |
2007 | | - | |
| 2007 | + | |
2008 | 2008 | | |
2009 | 2009 | | |
2010 | 2010 | | |
2011 | | - | |
| 2011 | + | |
2012 | 2012 | | |
2013 | 2013 | | |
2014 | 2014 | | |
| |||
2041 | 2041 | | |
2042 | 2042 | | |
2043 | 2043 | | |
2044 | | - | |
| 2044 | + | |
2045 | 2045 | | |
2046 | 2046 | | |
2047 | 2047 | | |
| |||
2073 | 2073 | | |
2074 | 2074 | | |
2075 | 2075 | | |
2076 | | - | |
2077 | | - | |
2078 | | - | |
2079 | | - | |
| 2076 | + | |
| 2077 | + | |
| 2078 | + | |
| 2079 | + | |
| 2080 | + | |
| 2081 | + | |
| 2082 | + | |
| 2083 | + | |
| 2084 | + | |
| 2085 | + | |
2080 | 2086 | | |
2081 | 2087 | | |
2082 | | - | |
| 2088 | + | |
2083 | 2089 | | |
2084 | 2090 | | |
2085 | 2091 | | |
| |||
2103 | 2109 | | |
2104 | 2110 | | |
2105 | 2111 | | |
| 2112 | + | |
2106 | 2113 | | |
| 2114 | + | |
2107 | 2115 | | |
2108 | 2116 | | |
2109 | 2117 | | |
| |||
2136 | 2144 | | |
2137 | 2145 | | |
2138 | 2146 | | |
| 2147 | + | |
| 2148 | + | |
| 2149 | + | |
| 2150 | + | |
| 2151 | + | |
| 2152 | + | |
| 2153 | + | |
| 2154 | + | |
| 2155 | + | |
2139 | 2156 | | |
2140 | 2157 | | |
2141 | 2158 | | |
| |||
2180 | 2197 | | |
2181 | 2198 | | |
2182 | 2199 | | |
2183 | | - | |
| 2200 | + | |
2184 | 2201 | | |
2185 | 2202 | | |
2186 | 2203 | | |
| |||
2243 | 2260 | | |
2244 | 2261 | | |
2245 | 2262 | | |
2246 | | - | |
2247 | | - | |
2248 | | - | |
2249 | | - | |
2250 | | - | |
2251 | | - | |
2252 | | - | |
2253 | | - | |
2254 | | - | |
2255 | | - | |
| 2263 | + | |
| 2264 | + | |
| 2265 | + | |
| 2266 | + | |
| 2267 | + | |
| 2268 | + | |
| 2269 | + | |
| 2270 | + | |
| 2271 | + | |
| 2272 | + | |
| 2273 | + | |
| 2274 | + | |
| 2275 | + | |
| 2276 | + | |
| 2277 | + | |
| 2278 | + | |
| 2279 | + | |
| 2280 | + | |
| 2281 | + | |
| 2282 | + | |
| 2283 | + | |
| 2284 | + | |
| 2285 | + | |
| 2286 | + | |
| 2287 | + | |
| 2288 | + | |
| 2289 | + | |
| 2290 | + | |
| 2291 | + | |
| 2292 | + | |
| 2293 | + | |
| 2294 | + | |
| 2295 | + | |
| 2296 | + | |
| 2297 | + | |
| 2298 | + | |
| 2299 | + | |
| 2300 | + | |
| 2301 | + | |
| 2302 | + | |
| 2303 | + | |
| 2304 | + | |
| 2305 | + | |
| 2306 | + | |
| 2307 | + | |
| 2308 | + | |
| 2309 | + | |
| 2310 | + | |
| 2311 | + | |
| 2312 | + | |
| 2313 | + | |
| 2314 | + | |
| 2315 | + | |
| 2316 | + | |
| 2317 | + | |
| 2318 | + | |
| 2319 | + | |
| 2320 | + | |
| 2321 | + | |
2256 | 2322 | | |
2257 | 2323 | | |
2258 | 2324 | | |
2259 | 2325 | | |
2260 | 2326 | | |
2261 | | - | |
| 2327 | + | |
2262 | 2328 | | |
2263 | | - | |
| 2329 | + | |
2264 | 2330 | | |
2265 | 2331 | | |
2266 | 2332 | | |
2267 | 2333 | | |
| 2334 | + | |
| 2335 | + | |
| 2336 | + | |
| 2337 | + | |
| 2338 | + | |
2268 | 2339 | | |
2269 | 2340 | | |
2270 | 2341 | | |
| |||
2274 | 2345 | | |
2275 | 2346 | | |
2276 | 2347 | | |
| 2348 | + | |
2277 | 2349 | | |
2278 | 2350 | | |
2279 | 2351 | | |
| |||
2321 | 2393 | | |
2322 | 2394 | | |
2323 | 2395 | | |
| 2396 | + | |
| 2397 | + | |
| 2398 | + | |
2324 | 2399 | | |
2325 | 2400 | | |
2326 | 2401 | | |
| |||
2921 | 2996 | | |
2922 | 2997 | | |
2923 | 2998 | | |
2924 | | - | |
2925 | | - | |
2926 | 2999 | | |
2927 | 3000 | | |
2928 | 3001 | | |
| |||
2975 | 3048 | | |
2976 | 3049 | | |
2977 | 3050 | | |
2978 | | - | |
| 3051 | + | |
2979 | 3052 | | |
2980 | 3053 | | |
2981 | 3054 | | |
2982 | 3055 | | |
2983 | | - | |
| 3056 | + | |
2984 | 3057 | | |
2985 | 3058 | | |
2986 | 3059 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
239 | 239 | | |
240 | 240 | | |
241 | 241 | | |
| 242 | + | |
| 243 | + | |
242 | 244 | | |
243 | 245 | | |
244 | 246 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
264 | 264 | | |
265 | 265 | | |
266 | 266 | | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
267 | 272 | | |
268 | 273 | | |
269 | 274 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1260 | 1260 | | |
1261 | 1261 | | |
1262 | 1262 | | |
1263 | | - | |
| 1263 | + | |
1264 | 1264 | | |
1265 | 1265 | | |
1266 | 1266 | | |
| |||
1284 | 1284 | | |
1285 | 1285 | | |
1286 | 1286 | | |
1287 | | - | |
1288 | | - | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
1289 | 1293 | | |
1290 | 1294 | | |
1291 | 1295 | | |
| |||
1344 | 1348 | | |
1345 | 1349 | | |
1346 | 1350 | | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
| 1378 | + | |
1347 | 1379 | | |
1348 | 1380 | | |
1349 | 1381 | | |
| |||
1540 | 1572 | | |
1541 | 1573 | | |
1542 | 1574 | | |
1543 | | - | |
1544 | | - | |
1545 | | - | |
1546 | | - | |
1547 | | - | |
1548 | | - | |
1549 | | - | |
1550 | | - | |
1551 | | - | |
1552 | 1575 | | |
1553 | 1576 | | |
1554 | 1577 | | |
| |||
1578 | 1601 | | |
1579 | 1602 | | |
1580 | 1603 | | |
1581 | | - | |
1582 | | - | |
1583 | | - | |
1584 | | - | |
1585 | | - | |
1586 | | - | |
1587 | | - | |
1588 | | - | |
1589 | | - | |
1590 | 1604 | | |
1591 | | - | |
1592 | | - | |
1593 | | - | |
| 1605 | + | |
| 1606 | + | |
| 1607 | + | |
| 1608 | + | |
1594 | 1609 | | |
1595 | 1610 | | |
1596 | 1611 | | |
| |||
0 commit comments