github-advanced-security[bot] commented on code in PR #851:
URL: 
https://github.com/apache/incubator-baremaps/pull/851#discussion_r1571400546


##########
baremaps-core/src/main/java/org/apache/baremaps/storage/geoparquet/GeoParquetTable.java:
##########
@@ -0,0 +1,571 @@
+/*
+ * 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.baremaps.storage.geoparquet;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.common.base.Objects;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.*;
+import java.util.stream.StreamSupport;
+import org.apache.baremaps.database.collection.AbstractDataCollection;
+import org.apache.baremaps.database.schema.*;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileStatus;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.parquet.avro.AvroReadSupport;
+import org.apache.parquet.column.page.PageReadStore;
+import org.apache.parquet.example.data.Group;
+import org.apache.parquet.example.data.simple.SimpleGroup;
+import org.apache.parquet.example.data.simple.convert.GroupRecordConverter;
+import org.apache.parquet.hadoop.ParquetFileReader;
+import org.apache.parquet.hadoop.metadata.FileMetaData;
+import org.apache.parquet.hadoop.metadata.ParquetMetadata;
+import org.apache.parquet.hadoop.util.HadoopInputFile;
+import org.apache.parquet.io.ColumnIOFactory;
+import org.apache.parquet.io.RecordReader;
+import org.apache.parquet.schema.LogicalTypeAnnotation;
+import org.apache.parquet.schema.MessageType;
+import org.apache.parquet.schema.PrimitiveType;
+import org.apache.parquet.schema.Type;
+import org.locationtech.jts.geom.Geometry;
+import org.locationtech.jts.io.WKBReader;
+
+public class GeoParquetTable extends AbstractDataCollection<DataRow> 
implements DataTable {
+
+  private Configuration configuration;
+
+  private WKBReader wkbReader = new WKBReader();
+
+  private Map<FileStatus, FileInfo> metadata = new HashMap<>();
+
+  private DataRowType rowType;
+
+  private Set<String> geometryColumns;
+
+  private long rowCount;
+
+  record FileInfo(
+      long rowCount,
+      ParquetMetadata parquetMetadata,
+      GeoParquetMetadata geoParquetMetadata,
+      DataRowType dataRowType) {
+  }
+
+  public GeoParquetTable(String uri) {
+        this.configuration = getConfiguration();
+
+        try {
+            // List all the files that match the glob pattern
+            URI fullUri = FileStatusIterator.getFullUri(uri);
+            Path globPath = new Path(fullUri.getPath());
+            URI rootUri = FileStatusIterator.getRootUri(fullUri);
+            FileSystem fileSystem = FileSystem.get(rootUri, configuration);
+            List<FileStatus> files = 
Arrays.asList(fileSystem.globStatus(globPath));
+
+            // Read the metadata of each file
+            for (FileStatus fileStatus : files) {
+
+                // Open the Parquet file
+                try (ParquetFileReader reader = ParquetFileReader
+                        .open(HadoopInputFile.fromPath(fileStatus.getPath(), 
configuration))) {
+
+                    // Read the number of rows in the Parquet file
+                    long rowCount = reader.getRecordCount();

Review Comment:
   ## Possible confusion of local and field
   
   Confusing name: [GeoParquetTable](1) also refers to field [rowCount](2) 
(without qualifying it with 'this').
   
   [Show more 
details](https://github.com/apache/incubator-baremaps/security/code-scanning/1003)



-- 
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]

Reply via email to