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


##########
baremaps-geoparquet/src/main/java/org/apache/baremaps/geoparquet/GeoParquetReader.java:
##########
@@ -0,0 +1,249 @@
+/*
+ * 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.geoparquet;
+
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.*;
+import java.util.concurrent.ArrayBlockingQueue;
+import java.util.function.Consumer;
+import java.util.stream.Stream;
+import java.util.stream.StreamSupport;
+import org.apache.baremaps.geoparquet.data.GeoParquetGroup;
+import org.apache.baremaps.geoparquet.data.GeoParquetGroup.Schema;
+import org.apache.baremaps.geoparquet.data.GeoParquetGroupFactory;
+import org.apache.baremaps.geoparquet.data.GeoParquetMetadata;
+import org.apache.baremaps.geoparquet.hadoop.GeoParquetGroupReadSupport;
+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.hadoop.ParquetFileReader;
+import org.apache.parquet.hadoop.ParquetReader;
+import org.apache.parquet.schema.MessageType;
+
+
+/**
+ * This reader is based on the parquet example code located at: 
org.apache.parquet.example.data.*.
+ */
+public class GeoParquetReader {
+
+  private final URI uri;
+
+  private final Configuration configuration;
+
+  private MessageType schema;
+
+  private Map<String, String> keyValueMetadata;
+
+  private GeoParquetMetadata metadata;
+
+  private GeoParquetGroup.Schema geoParquetSchema;
+
+  public GeoParquetReader(URI uri) {
+    this(uri, createConfiguration());
+  }
+
+  public GeoParquetReader(URI uri, Configuration configuration) {
+    this.uri = uri;
+    this.configuration = configuration;
+  }
+
+  public MessageType getParquetSchema() throws IOException, URISyntaxException 
{
+    if (schema == null) {
+      init();
+    }
+    return schema;
+  }
+
+  public GeoParquetMetadata getGeoParquetMetadata() throws IOException, 
URISyntaxException {
+    if (schema == null) {
+      init();
+    }
+    return metadata;
+  }
+
+  public Schema getGeoParquetSchema() throws IOException, URISyntaxException {
+    if (schema == null) {
+      init();
+    }
+    return geoParquetSchema;
+  }
+
+  private void init() throws URISyntaxException {
+    try {
+      Path globPath = new Path(uri.getPath());
+      URI rootUri = getRootUri(uri);
+      FileSystem fileSystem = FileSystem.get(rootUri, configuration);
+      List<FileStatus> files = Arrays.asList(fileSystem.globStatus(globPath));
+      FileStatus file = files.get(0);
+      ParquetFileReader reader = ParquetFileReader.open(configuration, 
file.getPath());

Review Comment:
   ## Deprecated method or constructor invocation
   
   Invoking [ParquetFileReader.open](1) should be avoided because it has been 
deprecated.
   
   [Show more 
details](https://github.com/apache/incubator-baremaps/security/code-scanning/1417)



##########
baremaps-core/src/main/java/org/apache/baremaps/storage/geoparquet/GeoParquetTable.java:
##########
@@ -0,0 +1,87 @@
+/*
+ * 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 java.net.URI;
+import java.util.Iterator;
+import java.util.Spliterator;
+import java.util.stream.Stream;
+import org.apache.baremaps.data.schema.*;
+import org.apache.baremaps.geoparquet.GeoParquetReader;
+import org.apache.baremaps.geoparquet.data.GeoParquetGroup.Schema;
+
+public class GeoParquetTable implements DataTable {
+
+  private final URI path;
+
+  private DataRowType rowType;
+
+  public GeoParquetTable(URI path) {
+    this.path = path;
+  }
+
+  @Override
+  public long size() {
+    return Long.MAX_VALUE;
+  }
+
+  @Override
+  public Iterator<DataRow> iterator() {
+    return parallelStream().iterator();
+  }
+
+  public Spliterator<DataRow> spliterator() {

Review Comment:
   ## Missing Override annotation
   
   This method overrides [DataCollection<DataRow>.spliterator](1); it is 
advisable to add an Override annotation.
   
   [Show more 
details](https://github.com/apache/incubator-baremaps/security/code-scanning/1418)



##########
baremaps-core/src/test/java/org/apache/baremaps/storage/geoparquet/GeoParquetDataSchemaTest.java:
##########
@@ -0,0 +1,45 @@
+/*
+ * 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 static org.junit.jupiter.api.Assertions.assertEquals;
+
+import org.apache.baremaps.testing.TestFiles;
+import org.junit.jupiter.api.Test;
+
+class GeoParquetDataSchemaTest {

Review Comment:
   ## Unused classes and interfaces
   
   Unused class: GeoParquetDataSchemaTest is not referenced within this 
codebase. If not used as an external API it should be removed.
   
   [Show more 
details](https://github.com/apache/incubator-baremaps/security/code-scanning/1419)



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