Source:
public synchronized void finishInsertIntoExistingPartition( ConnectorSession session, String databaseName, String tableName, List<String> partitionValues, Path currentLocation, List<String> fileNames, PartitionStatistics statisticsUpdate) { setShared(); SchemaTableName schemaTableName = new SchemaTableName(databaseName, tableName); Map<List<String>, Action<PartitionAndMore>> partitionActionsOfTable = partitionActions.computeIfAbsent(schemaTableName, k -> new HashMap<>()); Action<PartitionAndMore> oldPartitionAction = partitionActionsOfTable.get(partitionValues); if (oldPartitionAction == null) { Partition partition = delegate.getPartition(databaseName, tableName, partitionValues) .orElseThrow(() -> new PartitionNotFoundException(schemaTableName, partitionValues)); String partitionName = getPartitionName(databaseName, tableName, partitionValues); PartitionStatistics currentStatistics = delegate.getPartitionStatistics(databaseName, tableName, ImmutableSet.of(partitionName)).get(partitionName); verify(currentStatistics != null, "currentStatistics is null"); HdfsContext context = new HdfsContext(session, databaseName, tableName); partitionActionsOfTable.put( partitionValues, new Action<>( ActionType.INSERT_EXISTING, new PartitionAndMore( partition, currentLocation, Optional.of(fileNames), merge(currentStatistics, statisticsUpdate), statisticsUpdate), context)); return; } switch (oldPartitionAction.getType()) { case DROP: throw new PartitionNotFoundException(schemaTableName, partitionValues); case ADD: case ALTER: case INSERT_EXISTING: throw new UnsupportedOperationException("Inserting into a partition that were added, altered, or inserted into in the same transaction is not supported"); default: throw new IllegalStateException("Unknown action type"); } }

Target:
public synchronized void finishInsertIntoExistingPartition( ConnectorSession session, String databaseName, String tableName, List<String> partitionValues, Path currentLocation, List<String> fileNames, PartitionStatistics statisticsUpdate) { setShared(); SchemaTableName schemaTableName = new SchemaTableName(databaseName, tableName); Map<List<String>, Action<PartitionAndMore>> partitionActionsOfTable = partitionActions.computeIfAbsent(schemaTableName, k -> new HashMap<>()); Action<PartitionAndMore> oldPartitionAction = partitionActionsOfTable.get(partitionValues); if (oldPartitionAction == null) { Partition partition = delegate.getPartition(databaseName, tableName, partitionValues) .orElseThrow(() -> new PartitionNotFoundException(schemaTableName, partitionValues)); String partitionName = getPartitionName(databaseName, tableName, partitionValues); PartitionStatistics currentStatistics = delegate.getPartitionStatistics(databaseName, tableName, ImmutableSet.of(partitionName)).get(partitionName); if (currentStatistics == null) { throw new PrestoException(HIVE_METASTORE_ERROR, "currentStatistics is null"); } HdfsContext context = new HdfsContext(session, databaseName, tableName); partitionActionsOfTable.put( partitionValues, new Action<>( ActionType.INSERT_EXISTING, new PartitionAndMore( partition, currentLocation, Optional.of(fileNames), merge(currentStatistics, statisticsUpdate), statisticsUpdate), context)); return; } switch (oldPartitionAction.getType()) { case DROP: throw new PartitionNotFoundException(schemaTableName, partitionValues); case ADD: case ALTER: case INSERT_EXISTING: throw new UnsupportedOperationException("Inserting into a partition that were added, altered, or inserted into in the same transaction is not supported"); default: throw new IllegalStateException("Unknown action type"); } }