Пример #1
0
Dataflow Filter::getDataflow(){
	/** In the currently implementation, we assume that the boolean operator
	 * between each AttributeComparator is "AND".
	 */

	Dataflow dataflow=child_->getDataflow();
	if(comparator_list_.size()==0)
		generateComparatorList(dataflow);
	if(dataflow.isHashPartitioned()){
		for(unsigned i=0;i<dataflow.property_.partitioner.getNumberOfPartitions();i++){
			if(couldHashPruned(i,dataflow.property_.partitioner))//is filtered
			{
				dataflow.property_.partitioner.getPartition(i)->setFiltered();
			}
			else{
				/*
				 * should predict the volume of data that passes the filter.
				 * TODO: a precious prediction is needed based on the statistic of
				 * the input data, which may be maintained in the catalog module.
				 */
				const unsigned before_filter_cardinality=dataflow.property_.partitioner.getPartition(i)->getDataCardinality();
				const unsigned after_filter_cardinality=before_filter_cardinality*predictSelectivity();
				dataflow.property_.partitioner.getPartition(i)->setDataCardinality(after_filter_cardinality);
			}
		}
	}
	getcolindex(dataflow);
	Schema *input_=getSchema(dataflow.attribute_list_);
	for(int i=0;i<qual_.size();i++)
	{
		InitExprAtLogicalPlan(qual_[i],t_boolean,colindex_,input_);
	}
	return dataflow;
}
Пример #2
0
Dataflow Filter::getDataflow(){
	/** In the currently implementation, we assume that the boolean operator
	 * between each AttributeComparator is "AND".
	 */

	Dataflow dataflow=child_->getDataflow();
	generateComparatorList(dataflow);


	if(dataflow.isHashPartitioned()){
		for(unsigned i=0;i<dataflow.property_.partitioner.getNumberOfPartitions();i++){
			if(couldHashPruned(i,dataflow.property_.partitioner))//is filtered
			{
				dataflow.property_.partitioner.getPartition(i)->setFiltered();
			}
			else{
				/*
				 * should predict the volume of data that passes the filter.
				 * TODO: a precious prediction is needed based on the statistic of
				 * the input data, which may be maintained in the catalog module.
				 */
				const unsigned before_filter_datasize=dataflow.property_.partitioner.getPartition(i)->getDataSize();
				const unsigned after_filter_datasize=before_filter_datasize*predictSelectivity();
				dataflow.property_.partitioner.getPartition(i)->setDataSize(after_filter_datasize);
			}
		}
	}

	return dataflow;
}