Skip to content

Commit

Permalink
#9727 (#30) - use ST_Collect to improve bbox calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
lgoltz committed Oct 24, 2024
1 parent aca75ad commit 9118ed2
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,17 +202,17 @@ public String getSelectBBox(List<String> columns, List<TableName> tables) {
return super.getSelectBBox(columns, tables);
}
StringBuilder sql = new StringBuilder("SELECT ");
sql.append("ST_Extent( u.union )::BOX2D FROM (");
sql.append("ST_Extent( u.allbboxes )::BOX2D FROM (");
// subquery start
sql.append("SELECT ST_Union( ARRAY[ ");
sql.append("SELECT ST_Collect( ARRAY[ ");
boolean isFirst = true;
for (String column : columns) {
if (!isFirst)
sql.append(", ");
sql.append(getBBoxAggregateSnippet(column));
isFirst = false;
}
sql.append(" ] ) as union FROM ");
sql.append(" ] ) as allbboxes FROM ");
sql.append(tables.stream().map(SQLIdentifier::toString).collect(Collectors.joining(", ")));
// subquery end
sql.append(") u");
Expand Down

0 comments on commit 9118ed2

Please sign in to comment.