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


##########
baremaps-geoparquet/src/main/java/org/apache/baremaps/geoparquet/GeoParquetReader.java:
##########
@@ -0,0 +1,184 @@
+/*
+ * 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 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.GeoParquetGroupImpl;
+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.avro.AvroReadSupport;
+import org.apache.parquet.hadoop.ParquetReader;
+
+
+/**
+ * This reader is based on the parquet example code located at: 
org.apache.parquet.example.data.*.
+ */
+public class GeoParquetReader {
+
+  private final URI uri;
+
+  public GeoParquetReader(URI uri) {
+    this.uri = uri;
+  }
+
+  public Stream<GeoParquetGroupImpl> readParallel() throws IOException, 
URISyntaxException {
+    Configuration configuration = getConfiguration();
+    Path globPath = new Path(uri.getPath());
+    URI rootUri = getRootUri(uri);
+    FileSystem fileSystem = FileSystem.get(rootUri, configuration);
+    List<FileStatus> files = Arrays.asList(fileSystem.globStatus(globPath));
+    return StreamSupport.stream(
+        new GeoParquetGroupSpliterator(files),
+        true);
+  }
+
+  public Stream<GeoParquetGroupImpl> read() throws IOException, 
URISyntaxException {
+    return readParallel().sequential();
+  }
+
+  public class GeoParquetGroupSpliterator implements 
Spliterator<GeoParquetGroupImpl> {

Review Comment:
   ## Inner class could be static
   
   GeoParquetGroupSpliterator should be made static, since the enclosing 
instance is not used.
   
   [Show more 
details](https://github.com/apache/incubator-baremaps/security/code-scanning/1416)



##########
baremaps-geoparquet/src/main/java/org/apache/baremaps/geoparquet/hadoop/GeoParquetWriter.java:
##########
@@ -0,0 +1,118 @@
+/*
+ * 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.hadoop;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import org.apache.baremaps.geoparquet.data.GeoParquetGroupImpl;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.Path;
+import org.apache.parquet.column.ParquetProperties;
+import org.apache.parquet.hadoop.ParquetWriter;
+import org.apache.parquet.hadoop.api.WriteSupport;
+import org.apache.parquet.hadoop.metadata.CompressionCodecName;
+import org.apache.parquet.io.OutputFile;
+import org.apache.parquet.schema.MessageType;
+
+/**
+ * An example file writer class. THIS IS AN EXAMPLE ONLY AND NOT INTENDED FOR 
USE.
+ */
+public class GeoParquetWriter extends ParquetWriter<GeoParquetGroupImpl> {
+
+  /**
+   * Creates a Builder for configuring ParquetWriter with the example object 
model. THIS IS AN
+   * EXAMPLE ONLY AND NOT INTENDED FOR USE.
+   *
+   * @param file the output file to create
+   * @return a {@link Builder} to create a {@link ParquetWriter}
+   */
+  public static Builder builder(Path file) {
+    return new Builder(file);
+  }
+
+  /**
+   * Creates a Builder for configuring ParquetWriter with the example object 
model. THIS IS AN
+   * EXAMPLE ONLY AND NOT INTENDED FOR USE.
+   *
+   * @param file the output file to create
+   * @return a {@link Builder} to create a {@link ParquetWriter}
+   */
+  public static Builder builder(OutputFile file) {
+    return new Builder(file);
+  }
+
+  /**
+   * Create a new {@link GeoParquetWriter}.
+   *
+   * @param file The file name to write to.
+   * @param writeSupport The schema to write with.
+   * @param compressionCodecName Compression code to use, or 
CompressionCodecName.UNCOMPRESSED
+   * @param blockSize the block size threshold.
+   * @param pageSize See parquet write up. Blocks are subdivided into pages 
for alignment and other
+   *        purposes.
+   * @param enableDictionary Whether to use a dictionary to compress columns.
+   * @param conf The Configuration to use.
+   * @throws IOException
+   */
+  GeoParquetWriter(Path file, WriteSupport<GeoParquetGroupImpl> writeSupport,
+      CompressionCodecName compressionCodecName,
+      int blockSize, int pageSize, boolean enableDictionary,
+      boolean enableValidation,
+      ParquetProperties.WriterVersion writerVersion,
+      Configuration conf)
+      throws IOException {
+    super(file, writeSupport, compressionCodecName, blockSize, pageSize,
+        pageSize, enableDictionary, enableValidation, writerVersion, conf);

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



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