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/04/25 07:44:55 UTC

[GitHub] [shardingsphere] sandynz commented on issue #17086: java.lang.NullPointerException: null

sandynz commented on issue #17086:
URL: https://github.com/apache/shardingsphere/issues/17086#issuecomment-1108196303

   Hi @fanfantian , thanks for you feedback.
   
   I had a look at related code of stack trace:
   ```
   java.lang.NullPointerException: null
   at org.apache.shardingsphere.data.pipeline.core.record.RecordUtil.extractConditionColumns(RecordUtil.java:61)
   at org.apache.shardingsphere.data.pipeline.core.importer.AbstractImporter.executeUpdate(AbstractImporter.java:183)
   ```
   
   From `RecordUtil.extractConditionColumns`:
   ```
       public static List<Column> extractConditionColumns(final DataRecord dataRecord, final Set<String> shardingColumns) {
           List<Column> result = new ArrayList<>(dataRecord.getColumns().size());
           for (Column each : dataRecord.getColumns()) {
               if (each.isPrimaryKey() || shardingColumns.contains(each.getName())) { // Line 61
                   result.add(each);
               }
           }
           return result;
       }
   ```
   The NPE should be from `shardingColumns`.
   
   From `AbstractImporter.executeUpdate`:
   ```
       private void executeUpdate(final Connection connection, final DataRecord record) throws SQLException {
           List<Column> conditionColumns = RecordUtil.extractConditionColumns(record, importerConfig.getShardingColumnsMap().get(record.getTableName())); // Line 183
   ```
   It means `importerConfig.getShardingColumnsMap().get(record.getTableName())` return null.
   
   Could you help to do some debug to show `importerConfig.getShardingColumnsMap().get(record.getTableName())` value, `importerConfig.getShardingColumnsMap()` value and `record.getTableName()` value? Since I could not reproduce this issue on local.
   


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