bchapuis commented on code in PR #862:
URL:
https://github.com/apache/incubator-baremaps/pull/862#discussion_r1623798815
##########
baremaps-core/src/main/java/org/apache/baremaps/storage/geoparquet/GeoParquetDataStore.java:
##########
@@ -30,22 +30,24 @@
public class GeoParquetDataStore implements DataStore {
private final URI uri;
+ private final String tableName;
- public GeoParquetDataStore(URI uri) {
+ public GeoParquetDataStore(URI uri, String tableName) {
Review Comment:
Not sure we should add the table name here. We can set a new table name in
the add(String name, DataTable table) method.
##########
baremaps-core/src/main/java/org/apache/baremaps/storage/geoparquet/GeoParquetDataTable.java:
##########
@@ -32,12 +32,15 @@ public class GeoParquetDataTable implements DataTable {
private final URI path;
+ private final String name;
Review Comment:
Same here.
##########
baremaps-core/src/main/java/org/apache/baremaps/storage/geoparquet/GeoParquetTypeConversion.java:
##########
@@ -71,6 +71,10 @@ public static List<Object> asRowValues(GeoParquetGroup
group) {
List<Field> fields = schema.fields();
for (int i = 0; i < fields.size(); i++) {
Field field = fields.get(i);
+ if (group.getValues(i).isEmpty()) {
Review Comment:
Line 73 could be moved below this condition.
##########
baremaps-core/src/main/java/org/apache/baremaps/storage/geoparquet/GeoParquetTypeConversion.java:
##########
@@ -93,6 +97,10 @@ public static Map<String, Object> asNested(GeoParquetGroup
group) {
List<Field> fields = schema.fields();
for (int i = 0; i < fields.size(); i++) {
Field field = fields.get(i);
+ if (group.getValues(i).isEmpty()) {
Review Comment:
Same here.
##########
baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportGeoParquet.java:
##########
@@ -0,0 +1,98 @@
+/*
+ * 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.workflow.tasks;
+
+import java.net.URI;
+import java.util.StringJoiner;
+import org.apache.baremaps.data.storage.DataTableGeometryMapper;
+import org.apache.baremaps.data.storage.DataTableMapper;
+import org.apache.baremaps.openstreetmap.function.ProjectionTransformer;
+import org.apache.baremaps.storage.geoparquet.GeoParquetDataStore;
+import org.apache.baremaps.storage.geoparquet.GeoParquetDataTable;
+import org.apache.baremaps.storage.postgres.PostgresDataStore;
+import org.apache.baremaps.workflow.Task;
+import org.apache.baremaps.workflow.WorkflowContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Import a GeoParquet into a database.
+ */
+public class ImportGeoParquet implements Task {
+
+ private static final Logger logger =
LoggerFactory.getLogger(ImportGeoParquet.class);
+
+ private URI uri;
+ private String tableName;
+ private Object database;
+ private Integer databaseSrid;
+
+ /**
+ * Constructs a {@code ImportGeoParquet}.
+ */
+ public ImportGeoParquet() {
+
+ }
+
+ /**
+ * Constructs an {@code ImportGeoParquet}.
+ *
+ * @param uri the GeoParquet uri
+ * @param database the database
+ * @param databaseSrid the target SRID
+ */
+ public ImportGeoParquet(URI uri, String tableName, Object database, Integer
databaseSrid) {
+ this.uri = uri;
+ this.tableName = tableName;
+ this.database = database;
+ this.databaseSrid = databaseSrid;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void execute(WorkflowContext context) throws Exception {
+ var geoParquetDataStore = new GeoParquetDataStore(uri, tableName);
+ var dataSource = context.getDataSource(database);
+ var postgresDataStore = new PostgresDataStore(dataSource);
+ for (var name : geoParquetDataStore.list()) {
+ var geoParquetTable = (GeoParquetDataTable)
geoParquetDataStore.get(name);
+ // TODO : How can we apply a different SRID for each column based on the
geometry
Review Comment:
I'm not sure to understand this question.
--
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]