Source:
<code>public CostEstimate estimateCost( OptimizablePredicateList predList, ConglomerateDescriptor cd, CostEstimate outerCost, Optimizer optimizer, RowOrdering rowOrdering) throws StandardException { costEstimate = getScratchCostEstimate(optimizer); if (implementsVTICosting) { try { VTICosting vtic = getVTICosting(); estimatedCost = vtic.getEstimatedCostPerInstantiation(this); estimatedRowCount = vtic.getEstimatedRowCount(this); supportsMultipleInstantiations = vtic.supportsMultipleInstantiations(this); costEstimate.setEstimatedCost(estimatedCost); costEstimate.setRowCount(estimatedRowCount); costEstimate.setSingleScanRowCount(estimatedRowCount); costEstimate.setLocalCost(estimatedCost); costEstimate.setRemoteCost(estimatedCost); int numPartitions = costEstimate.partitionCount(); if (numPartitions <= 0) <START> numPartitions = 1; <END> costEstimate.setLocalCostPerPartition(estimatedCost/numPartitions); costEstimate.setRemoteCostPerPartition(estimatedCost/numPartitions); } catch (SQLException sqle) { throw StandardException.unexpectedUserException(sqle); } vtiCosted = true; } AccessPath currentAccessPath=getCurrentAccessPath(); JoinStrategy currentJoinStrategy=currentAccessPath.getJoinStrategy(); OptimizerTrace tracer =optimizer.tracer(); boolean oldIsAntiJoin = outerCost.isAntiJoin(); currentJoinStrategy.estimateCost(this,predList,cd,outerCost,optimizer,costEstimate); outerCost.setAntiJoin(oldIsAntiJoin); tracer.trace(OptimizerFlag.COST_OF_N_SCANS,tableNumber,0,outerCost.rowCount(),costEstimate, correlationName); return costEstimate; }</code><technical_language>code? Again? Please refactor a method calculation. wondering if partitionCount return 1 always. happen</technical_language>

Target:
public CostEstimate estimateCost( OptimizablePredicateList predList, ConglomerateDescriptor cd, CostEstimate outerCost, Optimizer optimizer, RowOrdering rowOrdering) throws StandardException { costEstimate = getScratchCostEstimate(optimizer); if (implementsVTICosting) { try { VTICosting vtic = getVTICosting(); estimatedCost = vtic.getEstimatedCostPerInstantiation(this); estimatedRowCount = vtic.getEstimatedRowCount(this); supportsMultipleInstantiations = vtic.supportsMultipleInstantiations(this); costEstimate.setEstimatedCost(estimatedCost); costEstimate.setRowCount(estimatedRowCount); costEstimate.setSingleScanRowCount(estimatedRowCount); costEstimate.setLocalCost(estimatedCost); costEstimate.setRemoteCost(estimatedCost); costEstimate.setLocalCostPerPartition(estimatedCost, costEstimate.partitionCount()); costEstimate.setRemoteCostPerPartition(estimatedCost, costEstimate.partitionCount()); } catch (SQLException sqle) { throw StandardException.unexpectedUserException(sqle); } vtiCosted = true; } AccessPath currentAccessPath=getCurrentAccessPath(); JoinStrategy currentJoinStrategy=currentAccessPath.getJoinStrategy(); OptimizerTrace tracer =optimizer.tracer(); boolean oldIsAntiJoin = outerCost.isAntiJoin(); currentJoinStrategy.estimateCost(this,predList,cd,outerCost,optimizer,costEstimate); outerCost.setAntiJoin(oldIsAntiJoin); tracer.trace(OptimizerFlag.COST_OF_N_SCANS,tableNumber,0,outerCost.rowCount(),costEstimate, correlationName); return costEstimate; }