Conversation
bc31c62 to
ba09078
Compare
ba09078 to
81bda14
Compare
| } | ||
|
|
||
| try { | ||
| subject.getInt(PG_NUMERIC_COLINDEX_NAN); |
There was a problem hiding this comment.
So one interesting thing regarding NaN is that the following assertion actually passes:
assertEquals(0, (int) Float.NaN)Do you know what the PostgreSQL JDBC driver returns in a case like this:
- Does it return zero (which would be consistent with how Java casts a
NaNto int)? - Or does it throw an error like here?
| assertEquals("NaN", subject.getString(PG_NUMERIC_COLINDEX_NAN)); | ||
| try { | ||
| subject.getByte(PG_NUMERIC_COLINDEX_NAN); | ||
| fail("missing expected SQLException"); |
There was a problem hiding this comment.
nit: can we use assertThrows(...) for these assertions instead of this try-fail construct. I know that there are many of them in this project, but that is because the original JDBC driver was written when Java 7 was the minimum supported version, which did not support assertThrows(..) (as it did not support lambda expressions)
| try { | ||
| Thread.sleep(1500); // Give gRPC server time to fully initialize | ||
| } catch (InterruptedException e) { | ||
| Thread.currentThread().interrupt(); | ||
| } |
There was a problem hiding this comment.
Is this really needed? I don't remember having seen any issues with this in the past for this repository. But it might be that recent versions of the emulator are more sensitive to this. (Could we maybe make it a bit more dynamic than always sleeping for 1.5 seconds?)
Updated the
getLonggetter inJdbcResultSetfor GoogleSQLNUMERICcolumns to usespanner.getBigDecimal(spannerIndex)instead ofgetString(). This prevents anIllegalStateExceptiongenerated by the underlying Spanner librarywe call
.toBigInteger()on the retrievedBigDecimalvalue to truncate fractional parts (e.g.,3.14becomes3).Other integer getters (
getByte,getShort,getInt) inJdbcResultSetand generic type conversions inJdbcTypeConverterhave been updated accordingly