paleolimbot commented on code in PR #45459: URL: https://github.com/apache/arrow/pull/45459#discussion_r1974527594
########## cpp/src/parquet/geometry_statistics.h: ########## @@ -0,0 +1,164 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#pragma once + +#include <cstdint> +#include <memory> + +#include "parquet/platform.h" +#include "parquet/types.h" + +namespace parquet { + +/// \brief Structure represented encoded statistics to be written to and read from Parquet +/// serialized metadata. +/// +/// See the Parquet Thrift definition and GeospatialStatistics for the specific definition +/// of field values. +class PARQUET_EXPORT EncodedGeospatialStatistics { + public: + static constexpr double kInf = std::numeric_limits<double>::infinity(); + + EncodedGeospatialStatistics() = default; + EncodedGeospatialStatistics(const EncodedGeospatialStatistics&) = default; + EncodedGeospatialStatistics(EncodedGeospatialStatistics&&) = default; + EncodedGeospatialStatistics& operator=(const EncodedGeospatialStatistics&) = default; + + double xmin{kInf}; + double xmax{-kInf}; + double ymin{kInf}; + double ymax{-kInf}; + double zmin{kInf}; + double zmax{-kInf}; + double mmin{kInf}; + double mmax{-kInf}; + std::vector<int32_t> geospatial_types; + + bool has_z() const { return (zmax - zmin) != -kInf; } Review Comment: I added `has_x()` and `has_y()`, which will both be`false` if everything is null or there have been no values bounded (because all geometries have X and Y`). `NaN` values are ignored, because an empty POINT is stored (by convention) as all `NaN`. I suppose this has the consequence that something with all NaN values might not be returned if a spatial filter is being pushed down. I personally think this is OK but will check to see what GDAL does for that case. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
