qixiaobo commented on a change in pull request #3288: fixes QueryResultUtil#getValueByColumnType unsigned int & bigint return value. URL: https://github.com/apache/incubator-shardingsphere/pull/3288#discussion_r335336254
########## File path: sharding-core/sharding-core-execute/src/main/java/org/apache/shardingsphere/core/execute/sql/execute/result/QueryResultUtil.java ########## @@ -135,4 +135,28 @@ private static Object getValueByColumnType(final ResultSet resultSet, final int return resultSet.getObject(columnIndex); } } + + private static Object getIntTypeValue(final ResultSet resultSet, final int columnIndex) throws SQLException { + ResultSetMetaData metaData = resultSet.getMetaData(); + if (metaData.isSigned(columnIndex)) { + return resultSet.getInt(columnIndex); + } + long value = resultSet.getLong(columnIndex); + if (value > Integer.MAX_VALUE) { + return value; + } + return (int) value; + } + + private static Object getBigIntTypeValue(final ResultSet resultSet, final int columnIndex) throws SQLException { + ResultSetMetaData metaData = resultSet.getMetaData(); + if (metaData.isSigned(columnIndex)) { + return resultSet.getLong(columnIndex); + } + BigDecimal value = resultSet.getBigDecimal(columnIndex); + if (new BigDecimal(Long.MAX_VALUE).compareTo(value) <= -1) { + return value; Review comment: maybe return value.toBigInteger()? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services