elastic / elasticsearch-sql-odbc

ODBC driver for Elasticsearch SQL
Other
0 stars 30 forks source link

Consider interval's precision. Allow non-aligned period values as interval encoding #148

Closed bpintea closed 5 years ago

bpintea commented 5 years ago

This PR fixes two related issues:

(1) 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:

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.

(2) The interval types with a seconds component have the seconds precision as a property. With this PR 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.