zhangfengcdt commented on code in PR #2971: URL: https://github.com/apache/parquet-java/pull/2971#discussion_r1759415679
########## parquet-column/src/main/java/org/apache/parquet/column/statistics/geometry/GeometryStatistics.java: ########## @@ -0,0 +1,200 @@ +/* + * 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. + */ +package org.apache.parquet.column.statistics.geometry; + +import java.nio.ByteBuffer; +import java.util.*; +import org.apache.parquet.Preconditions; +import org.apache.parquet.io.api.Binary; +import org.apache.parquet.schema.LogicalTypeAnnotation; +import org.locationtech.jts.geom.Geometry; +import org.locationtech.jts.io.ParseException; +import org.locationtech.jts.io.WKBReader; + +public class GeometryStatistics { + + // Metadata that may impact the statistics calculation + private final LogicalTypeAnnotation.Edges edges; + private final String crs; + private final ByteBuffer metadata; + + private final BoundingBox boundingBox; + private final Map<String, Covering> coverings; + private final GeometryTypes geometryTypes; + private final WKBReader reader = new WKBReader(); + + public GeometryStatistics( + LogicalTypeAnnotation.Edges edges, + String crs, + ByteBuffer metadata, + BoundingBox boundingBox, + List<Covering> coverings, + GeometryTypes geometryTypes) { + this.edges = edges; + this.crs = crs; + this.metadata = metadata; + this.boundingBox = supportsBoundingBox() ? boundingBox : null; + this.coverings = supportsCovering() ? new HashMap<>() : null; + this.geometryTypes = geometryTypes; + + if (this.coverings != null && coverings != null) { + for (Covering covering : coverings) { + // Assuming each Covering has a unique identifier (kind) or property that can be used as a key + String key = covering.getKind(); // Assume kind is unique + this.coverings.put(key, covering); Review Comment: The loop here is to initialize and populate the this.coverings map, so before it is populated, it is an empty map. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
