github-advanced-security[bot] commented on code in PR #802:
URL:
https://github.com/apache/incubator-baremaps/pull/802#discussion_r1398293238
##########
baremaps-core/src/main/java/org/apache/baremaps/workflow/WorkflowContext.java:
##########
@@ -41,4 +67,54 @@
return dataSources.computeIfAbsent(database,
PostgresUtils::createDataSourceFromObject);
}
+ public DataMap<Long, Coordinate> getCoordinateMap(Path path) throws
IOException {
+ if (Files.size(path) > 1 << 30) {
+ return getAlignedCoordinateMap();
+ } else {
+ return getMonotonicCoordinateMap();
+ }
+ }
+
+ public DataMap<Long, Coordinate> getAlignedCoordinateMap() throws
IOException {
+ var coordinateDir =
Files.createDirectories(cacheDir.resolve("coordinates"));
+ return new MemoryAlignedDataMap<>(
+ new LonLatDataType(),
+ new MemoryMappedDirectory(coordinateDir));
+ }
+
+ public DataMap<Long, Coordinate> getMonotonicCoordinateMap() throws
IOException {
+ var coordinateKeysDir =
Files.createDirectories(cacheDir.resolve("coordinate_keys"));
+ var coordinateValuesDir =
Files.createDirectories(cacheDir.resolve("coordinate_values"));
+ return new MonotonicDataMap<>(
+ new MemoryAlignedDataList<>(
+ new PairDataType<>(new LongDataType(), new LongDataType()),
+ new MemoryMappedDirectory(coordinateKeysDir)),
+ new AppendOnlyBuffer<>(
+ new LonLatDataType(),
+ new MemoryMappedDirectory(coordinateValuesDir)));
+ }
+
+ public DataMap<Long, List<Long>> getReferenceMap(Path path) throws
IOException {
Review Comment:
## Useless parameter
The parameter 'path' is never used.
[Show more
details](https://github.com/apache/incubator-baremaps/security/code-scanning/844)
--
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]