You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "sandynz (via GitHub)" <gi...@apache.org> on 2023/04/21 07:35:29 UTC

[GitHub] [shardingsphere] sandynz commented on a diff in pull request #25257: Fix delete event before values is null at pipeline DataRecord

sandynz commented on code in PR #25257:
URL: https://github.com/apache/shardingsphere/pull/25257#discussion_r1173397337


##########
kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/importer/DataRecordMerger.java:
##########
@@ -119,21 +119,22 @@ private void mergeUpdate(final DataRecord dataRecord, final Map<DataRecord.Key,
     }
     
     private void mergeDelete(final DataRecord dataRecord, final Map<DataRecord.Key, DataRecord> dataRecords) {
-        DataRecord beforeDataRecord = dataRecords.get(dataRecord.getKey());
+        DataRecord beforeDataRecord = dataRecords.get(dataRecord.getOldKey());

Review Comment:
   1, `dataRecord.getOldKey()` might be `null`?
   
   2, Could `dataRecord.getOldKey()` method name be updated?
   



##########
kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/importer/DataSourceImporter.java:
##########
@@ -221,7 +221,7 @@ private void executeUpdate(final Connection connection, final DataRecord record)
             }
             for (int i = 0; i < conditionColumns.size(); i++) {
                 Column keyColumn = conditionColumns.get(i);
-                preparedStatement.setObject(updatedColumns.size() + i + 1, keyColumn.isUniqueKey() && keyColumn.isUpdated() ? keyColumn.getOldValue() : keyColumn.getValue());
+                preparedStatement.setObject(updatedColumns.size() + i + 1, keyColumn.getOldValue());

Review Comment:
   `keyColumn.getOldValue()` might be `null`?



##########
kernel/data-pipeline/api/src/main/java/org/apache/shardingsphere/data/pipeline/api/ingest/record/Column.java:
##########
@@ -40,10 +40,6 @@ public final class Column {
     
     private final boolean uniqueKey;
     
-    public Column(final String name, final Object value, final boolean updated, final boolean uniqueKey) {
-        this(name, null, value, updated, uniqueKey);
-    }

Review Comment:
   Could we keep this constructor? To reduce unrelated changes



##########
kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/importer/DataRecordMerger.java:
##########
@@ -119,21 +119,22 @@ private void mergeUpdate(final DataRecord dataRecord, final Map<DataRecord.Key,
     }
     
     private void mergeDelete(final DataRecord dataRecord, final Map<DataRecord.Key, DataRecord> dataRecords) {
-        DataRecord beforeDataRecord = dataRecords.get(dataRecord.getKey());

Review Comment:
   Could we remove `mergeDelete` and `merge` methods etc



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