Commit c0ace37
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 8a5ca9d commit c0ace37
File tree
4 files changed
+158
-50
lines changed- driver
- test
4 files changed
+158
-50
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1913 | 1913 | | |
1914 | 1914 | | |
1915 | 1915 | | |
1916 | | - | |
| 1916 | + | |
1917 | 1917 | | |
1918 | 1918 | | |
1919 | 1919 | | |
| |||
1946 | 1946 | | |
1947 | 1947 | | |
1948 | 1948 | | |
| 1949 | + | |
1949 | 1950 | | |
1950 | 1951 | | |
1951 | 1952 | | |
| |||
2028 | 2029 | | |
2029 | 2030 | | |
2030 | 2031 | | |
| 2032 | + | |
| 2033 | + | |
| 2034 | + | |
| 2035 | + | |
| 2036 | + | |
| 2037 | + | |
| 2038 | + | |
| 2039 | + | |
| 2040 | + | |
| 2041 | + | |
| 2042 | + | |
| 2043 | + | |
| 2044 | + | |
| 2045 | + | |
2031 | 2046 | | |
2032 | 2047 | | |
2033 | 2048 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1778 | 1778 | | |
1779 | 1779 | | |
1780 | 1780 | | |
1781 | | - | |
| 1781 | + | |
1782 | 1782 | | |
1783 | 1783 | | |
1784 | 1784 | | |
1785 | | - | |
| 1785 | + | |
1786 | 1786 | | |
1787 | 1787 | | |
1788 | 1788 | | |
| |||
1815 | 1815 | | |
1816 | 1816 | | |
1817 | 1817 | | |
1818 | | - | |
| 1818 | + | |
1819 | 1819 | | |
1820 | 1820 | | |
1821 | 1821 | | |
| |||
1847 | 1847 | | |
1848 | 1848 | | |
1849 | 1849 | | |
1850 | | - | |
1851 | | - | |
1852 | | - | |
1853 | | - | |
| 1850 | + | |
| 1851 | + | |
| 1852 | + | |
| 1853 | + | |
| 1854 | + | |
| 1855 | + | |
| 1856 | + | |
| 1857 | + | |
| 1858 | + | |
| 1859 | + | |
1854 | 1860 | | |
1855 | 1861 | | |
1856 | | - | |
| 1862 | + | |
1857 | 1863 | | |
1858 | 1864 | | |
1859 | 1865 | | |
| |||
1877 | 1883 | | |
1878 | 1884 | | |
1879 | 1885 | | |
| 1886 | + | |
1880 | 1887 | | |
| 1888 | + | |
1881 | 1889 | | |
1882 | 1890 | | |
1883 | 1891 | | |
| |||
1910 | 1918 | | |
1911 | 1919 | | |
1912 | 1920 | | |
| 1921 | + | |
| 1922 | + | |
| 1923 | + | |
| 1924 | + | |
| 1925 | + | |
| 1926 | + | |
| 1927 | + | |
| 1928 | + | |
| 1929 | + | |
1913 | 1930 | | |
1914 | 1931 | | |
1915 | 1932 | | |
| |||
1954 | 1971 | | |
1955 | 1972 | | |
1956 | 1973 | | |
1957 | | - | |
| 1974 | + | |
1958 | 1975 | | |
1959 | 1976 | | |
1960 | 1977 | | |
| |||
2017 | 2034 | | |
2018 | 2035 | | |
2019 | 2036 | | |
2020 | | - | |
2021 | | - | |
2022 | | - | |
2023 | | - | |
2024 | | - | |
2025 | | - | |
2026 | | - | |
2027 | | - | |
2028 | | - | |
2029 | | - | |
| 2037 | + | |
| 2038 | + | |
| 2039 | + | |
| 2040 | + | |
| 2041 | + | |
| 2042 | + | |
| 2043 | + | |
| 2044 | + | |
| 2045 | + | |
| 2046 | + | |
| 2047 | + | |
| 2048 | + | |
| 2049 | + | |
| 2050 | + | |
| 2051 | + | |
| 2052 | + | |
| 2053 | + | |
| 2054 | + | |
| 2055 | + | |
| 2056 | + | |
| 2057 | + | |
| 2058 | + | |
| 2059 | + | |
| 2060 | + | |
| 2061 | + | |
| 2062 | + | |
| 2063 | + | |
| 2064 | + | |
| 2065 | + | |
| 2066 | + | |
| 2067 | + | |
| 2068 | + | |
| 2069 | + | |
| 2070 | + | |
| 2071 | + | |
| 2072 | + | |
| 2073 | + | |
| 2074 | + | |
| 2075 | + | |
| 2076 | + | |
| 2077 | + | |
| 2078 | + | |
| 2079 | + | |
| 2080 | + | |
| 2081 | + | |
| 2082 | + | |
| 2083 | + | |
| 2084 | + | |
| 2085 | + | |
| 2086 | + | |
| 2087 | + | |
| 2088 | + | |
| 2089 | + | |
| 2090 | + | |
| 2091 | + | |
| 2092 | + | |
| 2093 | + | |
| 2094 | + | |
| 2095 | + | |
2030 | 2096 | | |
2031 | 2097 | | |
2032 | 2098 | | |
2033 | 2099 | | |
2034 | 2100 | | |
2035 | | - | |
| 2101 | + | |
2036 | 2102 | | |
2037 | | - | |
| 2103 | + | |
2038 | 2104 | | |
2039 | 2105 | | |
2040 | 2106 | | |
2041 | 2107 | | |
| 2108 | + | |
| 2109 | + | |
| 2110 | + | |
| 2111 | + | |
| 2112 | + | |
2042 | 2113 | | |
2043 | 2114 | | |
2044 | 2115 | | |
| |||
2048 | 2119 | | |
2049 | 2120 | | |
2050 | 2121 | | |
| 2122 | + | |
2051 | 2123 | | |
2052 | 2124 | | |
2053 | 2125 | | |
| |||
2095 | 2167 | | |
2096 | 2168 | | |
2097 | 2169 | | |
| 2170 | + | |
| 2171 | + | |
| 2172 | + | |
2098 | 2173 | | |
2099 | 2174 | | |
2100 | 2175 | | |
| |||
2695 | 2770 | | |
2696 | 2771 | | |
2697 | 2772 | | |
2698 | | - | |
2699 | | - | |
2700 | 2773 | | |
2701 | 2774 | | |
2702 | 2775 | | |
| |||
2749 | 2822 | | |
2750 | 2823 | | |
2751 | 2824 | | |
2752 | | - | |
| 2825 | + | |
2753 | 2826 | | |
2754 | 2827 | | |
2755 | 2828 | | |
2756 | 2829 | | |
2757 | | - | |
| 2830 | + | |
2758 | 2831 | | |
2759 | 2832 | | |
2760 | 2833 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
162 | 167 | | |
163 | 168 | | |
164 | 169 | | |
| |||
| 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