mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-22 09:40:49 +00:00
Add OneBucketPolygonDictionary
This commit is contained in:
parent
52fc7b3147
commit
d8d0264acc
@ -187,6 +187,36 @@ bool SmartPolygonDictionary::find(const Point & point, size_t & id) const
|
||||
return found;
|
||||
}
|
||||
|
||||
OneBucketPolygonDictionary::OneBucketPolygonDictionary(
|
||||
const std::string & database_,
|
||||
const std::string & name_,
|
||||
const DictionaryStructure & dict_struct_,
|
||||
DictionarySourcePtr source_ptr_,
|
||||
const DictionaryLifetime dict_lifetime_,
|
||||
InputType input_type_,
|
||||
PointType point_type_)
|
||||
: IPolygonDictionary(database_, name_, dict_struct_, std::move(source_ptr_), dict_lifetime_, input_type_, point_type_),
|
||||
buckets_idx(this->polygons)
|
||||
{
|
||||
}
|
||||
|
||||
std::shared_ptr<const IExternalLoadable> OneBucketPolygonDictionary::clone() const
|
||||
{
|
||||
return std::make_shared<OneBucketPolygonDictionary>(
|
||||
this->database,
|
||||
this->name,
|
||||
this->dict_struct,
|
||||
this->source_ptr->clone(),
|
||||
this->dict_lifetime,
|
||||
this->input_type,
|
||||
this->point_type);
|
||||
}
|
||||
|
||||
bool OneBucketPolygonDictionary::find(const Point & point, size_t & id) const
|
||||
{
|
||||
return this->buckets_idx.find(point, id);
|
||||
}
|
||||
|
||||
template <class PolygonDictionary>
|
||||
DictionaryPtr createLayout(const std::string &,
|
||||
const DictionaryStructure & dict_struct,
|
||||
@ -255,6 +285,7 @@ void registerDictionaryPolygon(DictionaryFactory & factory)
|
||||
factory.registerLayout("polygon", createLayout<SimplePolygonDictionary>, true);
|
||||
factory.registerLayout("grid_polygon", createLayout<GridPolygonDictionary>, true);
|
||||
factory.registerLayout("bucket_polygon", createLayout<SmartPolygonDictionary>, true);
|
||||
factory.registerLayout("one_bucket_polygon", createLayout<OneBucketPolygonDictionary>, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -82,5 +82,26 @@ private:
|
||||
static constexpr size_t kMaxDepth = 7;
|
||||
};
|
||||
|
||||
/** Uses single BucketsPolygonIndex for all queries. */
|
||||
class OneBucketPolygonDictionary : public IPolygonDictionary
|
||||
{
|
||||
public:
|
||||
OneBucketPolygonDictionary(
|
||||
const std::string & database_,
|
||||
const std::string & name_,
|
||||
const DictionaryStructure & dict_struct_,
|
||||
DictionarySourcePtr source_ptr_,
|
||||
DictionaryLifetime dict_lifetime_,
|
||||
InputType input_type_,
|
||||
PointType point_type_);
|
||||
|
||||
std::shared_ptr<const IExternalLoadable> clone() const override;
|
||||
|
||||
private:
|
||||
bool find(const Point & point, size_t & id) const override;
|
||||
|
||||
BucketsPolygonIndex buckets_idx;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,8 @@ private:
|
||||
!executeDispatchComplex<TrieDictionary>(block, arguments, result, dict_ptr) &&
|
||||
!executeDispatchComplex<SimplePolygonDictionary>(block, arguments, result, dict_ptr) &&
|
||||
!executeDispatchComplex<GridPolygonDictionary>(block, arguments, result, dict_ptr) &&
|
||||
!executeDispatchComplex<SmartPolygonDictionary>(block, arguments, result, dict_ptr))
|
||||
!executeDispatchComplex<SmartPolygonDictionary>(block, arguments, result, dict_ptr) &&
|
||||
!executeDispatchComplex<OneBucketPolygonDictionary>(block, arguments, result, dict_ptr))
|
||||
throw Exception{"Unsupported dictionary type " + dict_ptr->getTypeName(), ErrorCodes::UNKNOWN_TYPE};
|
||||
}
|
||||
|
||||
@ -312,6 +313,7 @@ private:
|
||||
!executeDispatchComplex<SimplePolygonDictionary>(block, arguments, result, dict_ptr) &&
|
||||
!executeDispatchComplex<GridPolygonDictionary>(block, arguments, result, dict_ptr) &&
|
||||
!executeDispatchComplex<SmartPolygonDictionary>(block, arguments, result, dict_ptr) &&
|
||||
!executeDispatchComplex<OneBucketPolygonDictionary>(block, arguments, result, dict_ptr) &&
|
||||
!executeDispatchRange<RangeHashedDictionary>(block, arguments, result, dict_ptr))
|
||||
throw Exception{"Unsupported dictionary type " + dict_ptr->getTypeName(), ErrorCodes::UNKNOWN_TYPE};
|
||||
}
|
||||
@ -495,6 +497,7 @@ private:
|
||||
!executeDispatchComplex<SimplePolygonDictionary>(block, arguments, result, dict_ptr) &&
|
||||
!executeDispatchComplex<GridPolygonDictionary>(block, arguments, result, dict_ptr) &&
|
||||
!executeDispatchComplex<SmartPolygonDictionary>(block, arguments, result, dict_ptr) &&
|
||||
!executeDispatchComplex<OneBucketPolygonDictionary>(block, arguments, result, dict_ptr) &&
|
||||
!executeDispatchComplex<TrieDictionary>(block, arguments, result, dict_ptr))
|
||||
throw Exception{"Unsupported dictionary type " + dict_ptr->getTypeName(), ErrorCodes::UNKNOWN_TYPE};
|
||||
}
|
||||
@ -836,6 +839,7 @@ private:
|
||||
!executeDispatchComplex<SimplePolygonDictionary>(block, arguments, result, dict_ptr) &&
|
||||
!executeDispatchComplex<GridPolygonDictionary>(block, arguments, result, dict_ptr) &&
|
||||
!executeDispatchComplex<SmartPolygonDictionary>(block, arguments, result, dict_ptr) &&
|
||||
!executeDispatchComplex<OneBucketPolygonDictionary>(block, arguments, result, dict_ptr) &&
|
||||
!executeDispatchRange<RangeHashedDictionary>(block, arguments, result, dict_ptr))
|
||||
throw Exception{"Unsupported dictionary type " + dict_ptr->getTypeName(), ErrorCodes::UNKNOWN_TYPE};
|
||||
}
|
||||
@ -1097,6 +1101,7 @@ private:
|
||||
!executeDispatchComplex<SimplePolygonDictionary>(block, arguments, result, dict_ptr) &&
|
||||
!executeDispatchComplex<GridPolygonDictionary>(block, arguments, result, dict_ptr) &&
|
||||
!executeDispatchComplex<SmartPolygonDictionary>(block, arguments, result, dict_ptr) &&
|
||||
!executeDispatchComplex<OneBucketPolygonDictionary>(block, arguments, result, dict_ptr) &&
|
||||
!executeDispatchComplex<TrieDictionary>(block, arguments, result, dict_ptr))
|
||||
throw Exception{"Unsupported dictionary type " + dict_ptr->getTypeName(), ErrorCodes::UNKNOWN_TYPE};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user