swamirishi commented on a change in pull request #536:
URL: https://github.com/apache/incubator-sedona/pull/536#discussion_r695193899
##########
File path:
core/src/test/java/org/apache/sedona/core/io/parquet/ParquetFileReaderTest.java
##########
@@ -0,0 +1,87 @@
+package org.apache.sedona.core.io.parquet;
+
+import com.clearspring.analytics.util.Lists;
+import org.apache.commons.io.FileUtils;
+import org.apache.sedona.core.TestBase;
+import org.apache.sedona.core.enums.FileDataSplitter;
+import org.apache.sedona.core.enums.GeometryType;
+import org.apache.sedona.core.exceptions.SedonaException;
+import org.apache.sedona.core.formatMapper.ParquetReader;
+import org.apache.sedona.core.formatMapper.WktReader;
+import org.apache.sedona.core.formatMapper.WktReaderTest;
+import org.apache.sedona.core.spatialRDD.PointRDD;
+import org.apache.sedona.core.spatialRDD.SpatialRDD;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.locationtech.jts.geom.Point;
+import org.locationtech.jts.util.Assert;
+
+import java.io.IOException;
+import java.nio.file.FileSystem;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.stream.Collectors;
+
+public class ParquetFileReaderTest extends TestBase {
+ private static String filePath;
+ @BeforeClass
+ public static void onceExecutedBeforeAll()
+ throws IOException
+ {
+ initialize(ParquetFileReaderTest.class.getName());
+ filePath =
ParquetFileReaderTest.class.getClassLoader().getResource("crs-test-point.csv").getPath();
+ }
+
+ @AfterClass
+ public static void tearDown()
+ throws Exception
+ {
+ sc.stop();
+ }
+
+ @Before
+ public void delete() throws IOException {
+ if(testOutputPathDir.exists()){
+ FileUtils.deleteDirectory(testOutputPathDir);
+ }
+ }
+
+ @Test
+ public void testParquetReader() throws IOException, SedonaException {
+ PointRDD pointRDD = new PointRDD(sc, filePath, 0,
FileDataSplitter.CSV, false, 1);
+ pointRDD.saveAsParquet(sc,
+ "p",
+ Lists.newArrayList(),
+ testOutputPathDir.getAbsolutePath(),
+ "test.namespace",
+ "name");
+ List<Point> l1 =
pointRDD.getRawSpatialRDD().collect().stream().collect(Collectors.toList());
+ Collections.sort(l1, new Comparator<Point>() {
+ @Override
+ public int compare(Point o1, Point o2) {
+ return o1.compareTo(o2);
+ }
+ });
+
+ SpatialRDD<Point> pointRDD1 = ParquetReader.readToGeometryRDD(sc,
+
Arrays.stream(testOutputPathDir.listFiles())
Review comment:
We can, but if you see the text read and write contracts, they are the
same. I wanted to keep the contracts as similar as possible excepting for the
geometry column and projection column info. But if you feel we should have a
contract for getting files based for FileGlobs we can surely do that.
--
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]