Skip to content

Commit

Permalink
[dss] sort cell ids in queries
Browse files Browse the repository at this point in the history
  • Loading branch information
Shastick committed Sep 12, 2024
1 parent 97bbbe5 commit ec8d645
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkg/sql/utils.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package sql

import (
"github.com/golang/geo/s2"
"github.com/interuss/dss/pkg/geo"
"github.com/interuss/stacktrace"

"github.com/golang/geo/s2"
"slices"
)

func CellUnionToCellIds(cu s2.CellUnion) []int64 {
Expand All @@ -13,6 +13,8 @@ func CellUnionToCellIds(cu s2.CellUnion) []int64 {
// TODO consider validating the cell here: it is/was done in many similar conversion loops
pgCids[i] = int64(cell)
}
// Sort the cell IDs for optimisation purpose (see https://github.com/interuss/dss/issues/814)
slices.Sort(pgCids)
return pgCids
}

Expand All @@ -24,5 +26,7 @@ func CellUnionToCellIdsWithValidation(cu s2.CellUnion) ([]int64, error) {
}
pgCids[i] = int64(cell)
}
// Sort the cell IDs for optimisation purpose (see https://github.com/interuss/dss/issues/814)
slices.Sort(pgCids)
return pgCids, nil
}

0 comments on commit ec8d645

Please sign in to comment.