bchapuis commented on code in PR #860:
URL:
https://github.com/apache/incubator-baremaps/pull/860#discussion_r1624722329
##########
baremaps-core/src/main/java/org/apache/baremaps/storage/geoparquet/GeoParquetTypeConversion.java:
##########
@@ -69,9 +80,33 @@ public static List<Object> asRowValues(GeoParquetGroup
group) {
case DOUBLE -> values.add(group.getDoubleValue(i));
case STRING -> values.add(group.getStringValue(i));
case GEOMETRY -> values.add(group.getGeometryValue(i));
- case GROUP -> values.add(null); // TODO:
values.add(asDataRow(group.getGroupValue(i)));
+ case ENVELOPE -> values.add(group.getEnvelopeValue(i));
+ case GROUP -> values.add(asNested(group.getGroupValue(i)));
}
}
return values;
}
+
+ public static Map<String, Object> asNested(GeoParquetGroup group) {
+ Map<String, Object> nested = new HashMap<>();
+ Schema schema = group.getSchema();
+ List<Field> fields = schema.fields();
+ for (int i = 0; i < fields.size(); i++) {
+ Field field = fields.get(i);
+ nested.put(field.name(), switch (field.type()) {
+ case BINARY -> group.getBinaryValue(i).getBytes();
Review Comment:
@sebr72 The problem is that we also need to return Optional for each values
in a potentially very big geoparquet file. As for the List, I'm a bit worried
about the overhead. It also means that we need to return Optional for required
values.
Here are some interesting arguments for and against the use of Optional:
https://blogs.oracle.com/javamagazine/post/optional-class-null-pointer-drawbacks
--
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]