Vertica VerticaDayTimeInterval precision is stored wrongly

Precision is always a guideline for representation of data.
Data are always stored with a specific precision, which is the maximum precision supported by the driver (and the engine of course).
The precision that was used by the user to insert data is not stored in the database, as it is only useful when representing data.

Classic JDBC drivers support up to nanoseconds (precision of 9 digits) for java.sql.Timestamp.

Vertica JDBC driver supports up to microseconds (precision of 6 digits) for VerticaDateTimeInteval.

I don’t know what is exactly your intent when you want to specify a precision of 1, 2 or 3 in your sample code, but, IMHO when you create a new VerticaDateTimeInterval object and you want to define a number of second fractions, you have 2 main options (that make sense):

  • precision of 3, and the given fractions number would be in milliseconds
  • precision of 6, and the given fractions number would be in microseconds.

With a precision of 1, the number of fractions is in tenths of second.
With a precision of 2, is in hundredths of second.
With a precision of 4, is in 1/10000s of second.
With a precision of 5, is in 1/100000s of second.

Accordingly, when the database returns your query result, then it should inform you that the integer content of the fractions field of the returned object has a precision of 6 (meaning this is a number of microseconds).

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)