Source:
public void estimateCost(Optimizable innerTable, OptimizablePredicateList predList, ConglomerateDescriptor cd, CostEstimate outerCost, Optimizer optimizer, CostEstimate innerCost) throws StandardException{ if(outerCost.isUninitialized() ||(outerCost.localCost()==0d && outerCost.getEstimatedRowCount()==1.0)){ RowOrdering ro = outerCost.getRowOrdering(); if(ro!=null) outerCost.setRowOrdering(ro); return; } SpliceLogUtils.trace(LOG,"rightResultSetCostEstimate outerCost=%s, innerFullKeyCost=%s",outerCost,innerCost); innerCost.setBase(innerCost.cloneMe()); double estimatedRowCount = innerCost.getEstimatedRowCount(); SConfiguration configuration=EngineDriver.driver().getConfiguration(); long rowCountThreshold = configuration.getBroadcastRegionRowThreshold(); broadcastInner = estimatedRowCount < rowCountThreshold; double joinSelectivity = SelectivityUtil.estimateJoinSelectivity(innerTable, cd, predList, (long) innerCost.rowCount(), (long) outerCost.rowCount(), outerCost, SelectivityUtil.JoinPredicateType.ALL); double totalOutputRows = SelectivityUtil.getTotalRows(joinSelectivity, outerCost.rowCount(), innerCost.rowCount()); double totalJoinedRows = outerCost.rowCount() * innerCost.rowCount(); double joinCost = crossJoinStrategyLocalCost(innerCost, outerCost, totalJoinedRows); innerCost.setLocalCost(joinCost); innerCost.setLocalCostPerPartition(joinCost); double remoteCostPerPartition = SelectivityUtil.getTotalPerPartitionRemoteCost(innerCost, outerCost, totalOutputRows); innerCost.setRemoteCost(remoteCostPerPartition); innerCost.setRemoteCostPerPartition(remoteCostPerPartition); innerCost.setRowCount(totalOutputRows); innerCost.setEstimatedHeapSize((long) SelectivityUtil.getTotalHeapSize(innerCost, outerCost, totalOutputRows)); innerCost.setNumPartitions(outerCost.partitionCount()); innerCost.setRowOrdering(null); }

Target:
public void estimateCost(Optimizable innerTable, OptimizablePredicateList predList, ConglomerateDescriptor cd, CostEstimate outerCost, Optimizer optimizer, CostEstimate innerCost) throws StandardException{ if(outerCost.isUninitialized() ||(outerCost.localCost()==0d && outerCost.getEstimatedRowCount()==1.0)){ RowOrdering ro = outerCost.getRowOrdering(); if(ro!=null) outerCost.setRowOrdering(ro); return; } SpliceLogUtils.trace(LOG,"rightResultSetCostEstimate outerCost=%s, innerFullKeyCost=%s",outerCost,innerCost); innerCost.setBase(innerCost.cloneMe()); double joinSelectivity = SelectivityUtil.estimateJoinSelectivity(innerTable, cd, predList, (long) innerCost.rowCount(), (long) outerCost.rowCount(), outerCost, SelectivityUtil.JoinPredicateType.ALL); double totalOutputRows = SelectivityUtil.getTotalRows(joinSelectivity, outerCost.rowCount(), innerCost.rowCount()); double totalJoinedRows = outerCost.rowCount() * innerCost.rowCount(); double joinCost = crossJoinStrategyLocalCost(innerCost, outerCost, totalJoinedRows); innerCost.setLocalCost(joinCost); innerCost.setLocalCostPerPartition(joinCost); double remoteCostPerPartition = SelectivityUtil.getTotalPerPartitionRemoteCost(innerCost, outerCost, totalOutputRows); innerCost.setRemoteCost(remoteCostPerPartition); innerCost.setRemoteCostPerPartition(remoteCostPerPartition); innerCost.setRowCount(totalOutputRows); innerCost.setEstimatedHeapSize((long) SelectivityUtil.getTotalHeapSize(innerCost, outerCost, totalOutputRows)); innerCost.setNumPartitions(outerCost.partitionCount()); innerCost.setRowOrdering(null); }