Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a simple Overture example #862

Merged
merged 5 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Clean up code
  • Loading branch information
Drabble committed Jun 4, 2024
commit 0ca7f6e0760ba6d19fa3f7e1100665838b645f28
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ public void execute(WorkflowContext context) throws Exception {
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
var projectionTransformer =
new ProjectionTransformer(geoParquetTable.srid("geometry"), databaseSrid);
var rowTransformer =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,24 +100,8 @@ private synchronized Map<FileStatus, FileInfo> files() throws URISyntaxException
FileSystem fs = FileSystem.get(uri, configuration);
FileStatus[] fileStatuses = fs.globStatus(new Path(uri));

for (FileStatus fileStatus : fileStatuses) {
Path filePath = fileStatus.getPath();
ParquetFileReader reader = ParquetFileReader.open(configuration, filePath);
Long recordCount = reader.getRecordCount();
MessageType messageType = reader.getFileMetaData().getSchema();
Map<String, String> keyValueMetadata = reader.getFileMetaData().getKeyValueMetaData();
GeoParquetMetadata geoParquetMetadata = null;
GeoParquetGroup.Schema geoParquetSchema = null;
if (keyValueMetadata.containsKey("geo")) {
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
geoParquetMetadata =
objectMapper.readValue(keyValueMetadata.get("geo"), GeoParquetMetadata.class);
geoParquetSchema =
GeoParquetGroupFactory.createGeoParquetSchema(messageType, geoParquetMetadata);
}
files.put(fileStatus, new FileInfo(fileStatus, recordCount, keyValueMetadata, messageType,
geoParquetMetadata, geoParquetSchema));
for (FileStatus file : fileStatuses) {
files.put(file, buildFileInfo(file));
}

// Verify that the files all have the same schema
Expand All @@ -126,12 +110,12 @@ private synchronized Map<FileStatus, FileInfo> files() throws URISyntaxException
if (commonMessageType == null) {
commonMessageType = entry.messageType;
} else if (!commonMessageType.equals(entry.messageType)) {
throw new RuntimeException("The files do not have the same schema");
throw new GeoParquetException("The files do not have the same schema");
}
}
}
} catch (IOException e) {
throw new RuntimeException("IOException while attempting to list files.", e);
throw new GeoParquetException("IOException while attempting to list files.", e);
}
return files;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ private void appendToString(StringBuilder builder, String indent) {
}
}

@Override
public List<Primitive> getValues(int fieldIndex) {
Fixed Show fixed Hide fixed
return (List<Primitive>) data[fieldIndex];
}
Expand Down
Loading