diff --git a/src/main/java/com/taosdata/jdbc/TSDBResultSetBlockData.java b/src/main/java/com/taosdata/jdbc/TSDBResultSetBlockData.java index 45ce7352..d4f34777 100644 --- a/src/main/java/com/taosdata/jdbc/TSDBResultSetBlockData.java +++ b/src/main/java/com/taosdata/jdbc/TSDBResultSetBlockData.java @@ -381,7 +381,9 @@ public int getInt(int col) throws SQLException { return ((Long) ((Timestamp) obj).getTime()).intValue(); } - case TSDB_DATA_TYPE_FLOAT: + case TSDB_DATA_TYPE_FLOAT:{ + return ((Float) obj).intValue(); + } case TSDB_DATA_TYPE_DOUBLE: { return ((Double) obj).intValue(); } diff --git a/src/test/java/com/taosdata/jdbc/block/TSDBBlockResultSetTest.java b/src/test/java/com/taosdata/jdbc/block/TSDBBlockResultSetTest.java index 2bff4468..2122556e 100644 --- a/src/test/java/com/taosdata/jdbc/block/TSDBBlockResultSetTest.java +++ b/src/test/java/com/taosdata/jdbc/block/TSDBBlockResultSetTest.java @@ -70,6 +70,9 @@ public void getInt() throws SQLException { Assert.assertEquals(1, f2); f2 = rs.getInt(2); Assert.assertEquals(1, f2); + + f2 = rs.getInt(4); + Assert.assertEquals(3, f2); } @Test