PlanPartitioner::PlanPartitioner(const Partitioner& partitioner) { partition_func_ = partitioner.getPartitionFunction(); partition_key_ = partitioner.getPartitionKey(); for (unsigned i = 0; i < partitioner.getNumberOfPartitions(); i++) { PlanPartitionInfo plan_partition_info; plan_partition_info.cardinality_ = partitioner.getPartitionCardinality(i); plan_partition_info.location_ = partitioner.getPartitionLocation(i); plan_partition_info.partition_id_ = i; partition_list_.push_back(plan_partition_info); } }
DataflowPartitioningDescriptor::DataflowPartitioningDescriptor(const Partitioner& partitioner){ partition_function_=partitioner.getPartitionFunction(); partition_key_=partitioner.getPartitionKey(); for(unsigned i=0;i<partitioner.getNumberOfPartitions();i++){ DataflowPartition dataflow_partition; dataflow_partition.datasize_=partitioner.getPartitionDataSize(i); dataflow_partition.location_=partitioner.getPartitionLocation(i); dataflow_partition.partition_id_=i; partition_list_.push_back(dataflow_partition); } }
bool Partitioner::hasSamePartitionLocation(const Partitioner & target_partition )const{ if(mode_==OneToMany||target_partition.get_binding_mode_()==OneToMany){ /** in the current version, any the location detection in OneToMany mode is ommited.*/ return false; } if(getNumberOfPartitions()!=target_partition.getNumberOfPartitions()) return false; for(unsigned i=0;i<getNumberOfPartitions();i++){ if(!partition_info_list[i]->is_colocated(*target_partition.partition_info_list[i])){ return false; } } return true; }