tuichenchuxin commented on code in PR #23564:
URL: https://github.com/apache/shardingsphere/pull/23564#discussion_r1070745385


##########
features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/metadata/data/ShardingStatisticsTableCollector.java:
##########
@@ -117,6 +123,28 @@ private void addForMySQL(final Map<String, DataSource> 
dataSources, final DataNo
         row.add(dataLength);
     }
     
+    private void addForPostgreSQL(final Map<String, DataSource> dataSources, 
final DataNode dataNode, final List<Object> row) throws SQLException {
+        DataSource dataSource = dataSources.get(dataNode.getDataSourceName());
+        BigDecimal tableRows = BigDecimal.ZERO;
+        BigDecimal dataLength = BigDecimal.ZERO;
+        try (
+                Connection connection = dataSource.getConnection();
+                Statement statement = connection.createStatement()) {
+            try (ResultSet resultSet = 
statement.executeQuery(String.format(POSTGRESQL_TABLE_ROWS_LENGTH, 
dataNode.getSchemaName(), dataNode.getTableName()))) {
+                if (resultSet.next()) {
+                    dataLength = resultSet.getBigDecimal("TABLE_ROWS");

Review Comment:
   ```suggestion
                       tableRows = resultSet.getBigDecimal("TABLE_ROWS");
   ```



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to