You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/01/11 10:53:52 UTC

[GitHub] [shardingsphere] ReyYang commented on a change in pull request #14688: For #14604:Fix "Data truncated for column" error occurs during the migration of the year type field

ReyYang commented on a change in pull request #14688:
URL: https://github.com/apache/shardingsphere/pull/14688#discussion_r782030669



##########
File path: shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-mysql/src/main/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/MySQLInventoryDumper.java
##########
@@ -42,7 +44,9 @@ public MySQLInventoryDumper(final InventoryDumperConfiguration inventoryDumperCo
     
     @Override
     public Object readValue(final ResultSet resultSet, final int index) throws SQLException {
-        if (isDateTimeValue(resultSet.getMetaData().getColumnType(index))) {
+        if (isYearDataType(resultSet.getMetaData().getColumnTypeName(index))) {
+            return resultSet.getObject(index) == null ? null : resultSet.getShort(index);
+        } else if (isDateTimeValue(resultSet.getMetaData().getColumnType(index))) {
             return resultSet.getString(index);
         } else {

Review comment:
       No, it is necessary to first determine whether it is the year data type




-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org