The Vertica Forum recently got a makeover! Let us know what you think by filling out this short, anonymous survey.

VerticaDayTimeInterval data added through constructor is displayed incorrectly

EDIT:

Please point out if others are not seeing this issue and I am doing something wrong.

 

I added a row containing VerticaDayTimeInterval thourgh java program, but the fractional part was incorrect in table.

 

dayInt = new VerticaDayTimeInterval(10, 10, 01, 8, 2, 1, false) ; ((VerticaPreparedStatement) pstmt).setObject(1, dayInt) ; pstmt.addBatch() ; System.out.println(dayInt.toString());
dayInt = new VerticaDayTimeInterval(10, 10, 02, 7, 3, 2, false) ; ((VerticaPreparedStatement) pstmt).setObject(1, dayInt) ; pstmt.addBatch() ; System.out.println(dayInt.toString());
dayInt = new VerticaDayTimeInterval(10, 10, 03, 6, 43, 3, false) ; ((VerticaPreparedStatement) pstmt).setObject(1, dayInt) ; pstmt.addBatch() ; System.out.println(dayInt.toString());

sysout output

 

10 10:01:08.2
10 10:02:07.03
10 10:03:06.043

 

table ouput

 

10 10:01:08.000002
10 10:02:07.000003
10 10:03:06.000043

 

And on retrieval it is printed as

System.out.println(x + ". " + rs.getString(1) );
VerticaDayTimeInterval dti = (VerticaDayTimeInterval)(rs.getObject(1));
System.out.println(dti.toString()+" frac "+dti.getFraction()+" precision "+dti.getPrecision());

Output

 

1. 10 10:01:08.200000
10 10:01:08.200000 frac 200000 precision 6
2. 10 10:02:07.300000
10 10:02:07.300000 frac 300000 precision 6
3. 10 10:03:06.430000 8-07
10 10:03:06.430000 frac 430000 precision 6

Somehow it has precision of 6, this also happens if table was added though setString in PrepareStatement.

 

 

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file

Can't find what you're looking for? Search the Vertica Documentation, Knowledge Base, or Blog for more information.