github-advanced-security[bot] commented on code in PR #899: URL: https://github.com/apache/incubator-baremaps/pull/899#discussion_r1807486902
########## baremaps-geoparquet/src/test/java/org/apache/baremaps/geoparquet/GeoParquetWriterTest.java: ########## @@ -0,0 +1,110 @@ +/* + * 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 static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.apache.baremaps.geoparquet.GeoParquetMetadata.Column; +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.fs.Path; +import org.apache.parquet.schema.MessageType; +import org.apache.parquet.schema.OriginalType; +import org.apache.parquet.schema.PrimitiveType.PrimitiveTypeName; +import org.apache.parquet.schema.Types; +import org.junit.jupiter.api.Test; +import org.locationtech.jts.geom.Coordinate; +import org.locationtech.jts.geom.GeometryFactory; +import org.locationtech.jts.geom.Point; + +class GeoParquetWriterTest { + + @Test + public void testWriteAndReadGeoParquet() throws IOException { + // Define the Parquet schema + MessageType schema = Types.buildMessage() + .required(PrimitiveTypeName.BINARY).as(OriginalType.UTF8).named("name") Review Comment: ## Deprecated method or constructor invocation Invoking [Builder.as](1) should be avoided because it has been deprecated. [Show more details](https://github.com/apache/incubator-baremaps/security/code-scanning/1583) ########## baremaps-geoparquet/src/main/java/org/apache/baremaps/geoparquet/GeoParquetWriter.java: ########## @@ -0,0 +1,77 @@ +/* + * 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 org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.fs.Path; +import org.apache.parquet.column.ParquetProperties; +import org.apache.parquet.column.ParquetProperties.WriterVersion; +import org.apache.parquet.hadoop.ParquetWriter; +import org.apache.parquet.hadoop.metadata.CompressionCodecName; +import org.apache.parquet.schema.MessageType; + +/** + * A writer for GeoParquet files that writes GeoParquetGroup instances to a Parquet file. + */ +public class GeoParquetWriter { + + private final ParquetWriter<GeoParquetGroup> parquetWriter; + + /** + * Constructs a new GeoParquetWriter. + * + * @param outputFile the output file + * @param schema the Parquet schema + * @param metadata the GeoParquet metadata + * @throws IOException if an I/O error occurs + */ + public GeoParquetWriter(Path outputFile, MessageType schema, GeoParquetMetadata metadata) + throws IOException { + this.parquetWriter = new ParquetWriter<>( + outputFile, + new GeoParquetWriteSupport(schema, metadata), + CompressionCodecName.UNCOMPRESSED, + ParquetWriter.DEFAULT_BLOCK_SIZE, + ParquetWriter.DEFAULT_PAGE_SIZE, + ParquetWriter.DEFAULT_PAGE_SIZE, + ParquetWriter.DEFAULT_IS_DICTIONARY_ENABLED, + ParquetWriter.DEFAULT_IS_VALIDATING_ENABLED, + WriterVersion.PARQUET_2_0, + new Configuration()); 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/1581) ########## baremaps-geoparquet/src/test/java/org/apache/baremaps/geoparquet/GeoParquetWriterTest.java: ########## @@ -0,0 +1,110 @@ +/* + * 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 static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.apache.baremaps.geoparquet.GeoParquetMetadata.Column; +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.fs.Path; +import org.apache.parquet.schema.MessageType; +import org.apache.parquet.schema.OriginalType; +import org.apache.parquet.schema.PrimitiveType.PrimitiveTypeName; +import org.apache.parquet.schema.Types; +import org.junit.jupiter.api.Test; +import org.locationtech.jts.geom.Coordinate; +import org.locationtech.jts.geom.GeometryFactory; +import org.locationtech.jts.geom.Point; + +class GeoParquetWriterTest { + + @Test + public void testWriteAndReadGeoParquet() throws IOException { + // Define the Parquet schema + MessageType schema = Types.buildMessage() + .required(PrimitiveTypeName.BINARY).as(OriginalType.UTF8).named("name") + .required(PrimitiveTypeName.BINARY).as(OriginalType.UTF8).named("city") Review Comment: ## Deprecated method or constructor invocation Invoking [Builder.as](1) should be avoided because it has been deprecated. [Show more details](https://github.com/apache/incubator-baremaps/security/code-scanning/1582) -- 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]
