diff options
author | robot-contrib <[email protected]> | 2025-07-31 18:00:57 +0300 |
---|---|---|
committer | robot-contrib <[email protected]> | 2025-07-31 18:24:59 +0300 |
commit | f621c90694c03bdc1992bd3cb726ff315a9627d5 (patch) | |
tree | aabd88e8bca000ac17fe21727b68d360189c6442 /contrib/libs/apache/orc/c++/src/Statistics.cc | |
parent | 190037200407b9e5215a7af324af558d778588b5 (diff) |
Update contrib/libs/apache/orc to 2.2.0
commit_hash:e0bdaabcbb3fe0971f373bd76ccaccb105aff7d3
Diffstat (limited to 'contrib/libs/apache/orc/c++/src/Statistics.cc')
-rw-r--r-- | contrib/libs/apache/orc/c++/src/Statistics.cc | 62 |
1 files changed, 59 insertions, 3 deletions
diff --git a/contrib/libs/apache/orc/c++/src/Statistics.cc b/contrib/libs/apache/orc/c++/src/Statistics.cc index 76fd736b27e..a86247f1070 100644 --- a/contrib/libs/apache/orc/c++/src/Statistics.cc +++ b/contrib/libs/apache/orc/c++/src/Statistics.cc @@ -44,6 +44,8 @@ namespace orc { return new DateColumnStatisticsImpl(s, statContext); } else if (s.has_binary_statistics()) { return new BinaryColumnStatisticsImpl(s, statContext); + } else if (s.has_geospatial_statistics()) { + return new GeospatialColumnStatisticsImpl(s); } else { return new ColumnStatisticsImpl(s); } @@ -81,11 +83,20 @@ namespace orc { // PASS } - StripeStatisticsImpl::StripeStatisticsImpl( + StripeStatisticsImpl::StripeStatisticsImpl(const proto::StripeStatistics& stripeStats, + const StatContext& statContext) { + columnStats_ = std::make_unique<StatisticsImpl>(stripeStats, statContext); + } + + StripeStatisticsWithRowGroupIndexImpl::~StripeStatisticsWithRowGroupIndexImpl() { + // PASS + } + + StripeStatisticsWithRowGroupIndexImpl::StripeStatisticsWithRowGroupIndexImpl( const proto::StripeStatistics& stripeStats, std::vector<std::vector<proto::ColumnStatistics> >& indexStats, - const StatContext& statContext) { - columnStats_ = std::make_unique<StatisticsImpl>(stripeStats, statContext); + const StatContext& statContext) + : StripeStatisticsImpl(stripeStats, statContext) { rowIndexStats_.resize(indexStats.size()); for (size_t i = 0; i < rowIndexStats_.size(); i++) { for (size_t j = 0; j < indexStats[i].size(); j++) { @@ -139,6 +150,10 @@ namespace orc { // PASS } + GeospatialColumnStatistics::~GeospatialColumnStatistics() { + // PASS + } + ColumnStatisticsImpl::~ColumnStatisticsImpl() { // PASS } @@ -179,6 +194,10 @@ namespace orc { // PASS } + GeospatialColumnStatisticsImpl::~GeospatialColumnStatisticsImpl() { + // PASS + } + ColumnStatisticsImpl::ColumnStatisticsImpl(const proto::ColumnStatistics& pb) { stats_.setNumberOfValues(pb.number_of_values()); stats_.setHasNull(pb.has_has_null() ? pb.has_null() : true); @@ -382,6 +401,40 @@ namespace orc { } } + GeospatialColumnStatisticsImpl::GeospatialColumnStatisticsImpl( + const proto::ColumnStatistics& pb) { + reset(); + if (!pb.has_geospatial_statistics()) { + bounder_.invalidate(); + } else { + const proto::GeospatialStatistics& stats = pb.geospatial_statistics(); + geospatial::BoundingBox::XYZM min; + geospatial::BoundingBox::XYZM max; + for (int i = 0; i < geospatial::MAX_DIMENSIONS; i++) { + min[i] = max[i] = std::numeric_limits<double>::quiet_NaN(); + } + if (stats.has_bbox()) { + const auto& protoBBox = stats.bbox(); + min[0] = protoBBox.xmin(); + min[1] = protoBBox.ymin(); + max[0] = protoBBox.xmax(); + max[1] = protoBBox.ymax(); + if (protoBBox.has_zmin() && protoBBox.has_zmax()) { + min[2] = protoBBox.zmin(); + max[2] = protoBBox.zmax(); + } + if (protoBBox.has_mmin() && protoBBox.has_mmax()) { + min[3] = protoBBox.mmin(); + max[3] = protoBBox.mmax(); + } + } + bounder_.mergeBox(geospatial::BoundingBox(min, max)); + std::vector<int32_t> types = {stats.geospatial_types().begin(), + stats.geospatial_types().end()}; + bounder_.mergeGeometryTypes(types); + } + } + std::unique_ptr<MutableColumnStatistics> createColumnStatistics(const Type& type) { switch (static_cast<int64_t>(type.getKind())) { case BOOLEAN: @@ -413,6 +466,9 @@ namespace orc { return std::make_unique<TimestampColumnStatisticsImpl>(); case DECIMAL: return std::make_unique<DecimalColumnStatisticsImpl>(); + case GEOGRAPHY: + case GEOMETRY: + return std::make_unique<GeospatialColumnStatisticsImpl>(); default: throw NotImplementedYet("Not supported type: " + type.toString()); } |