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 ce4e2ac
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions pkg/sql/utils.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package sql

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

"github.com/golang/geo/s2"
"github.com/golang/geo/s2"
"github.com/interuss/dss/pkg/geo"
"github.com/interuss/stacktrace"
"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 ce4e2ac

Please sign in to comment.