Skip to content

Commit

Permalink
colexec: remove UNSAFEGET
Browse files Browse the repository at this point in the history
gcassert now supports marking methods as inlined, so we can guarantee
that methods are inlined without having to insert a comment on each
callsite.
  • Loading branch information
jordanlewis committed Jul 6, 2020
1 parent f61d73f commit 0a1a7c2
Show file tree
Hide file tree
Showing 61 changed files with 20,520 additions and 20,606 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ require (
github.com/jackc/pgx v3.6.2+incompatible
github.com/jaegertracing/jaeger v1.17.0
github.com/jcmturner/gofork v1.0.0 // indirect
github.com/jordanlewis/gcassert v0.0.0-20200630054945-8ff878e72753
github.com/jordanlewis/gcassert v0.0.0-20200706043056-bf61eb72ee48
github.com/kevinburke/go-bindata v3.13.0+incompatible
github.com/kisielk/errcheck v1.2.0
github.com/kisielk/gotool v1.0.0
Expand Down Expand Up @@ -154,7 +154,7 @@ require (
golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae
golang.org/x/text v0.3.2
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4
golang.org/x/tools v0.0.0-20200626171337-aa94e735be7f
golang.org/x/tools v0.0.0-20200702044944-0cc1aa72b347
google.golang.org/api v0.1.0
google.golang.org/genproto v0.0.0-20200218151345-dad8c97a84f5 // indirect
google.golang.org/grpc v1.29.1
Expand Down
6 changes: 4 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -374,8 +374,8 @@ github.com/jcmturner/gofork v1.0.0/go.mod h1:MK8+TM0La+2rjBD4jE12Kj1pCCxK7d2LK/U
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM=
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
github.com/jordanlewis/gcassert v0.0.0-20200630054945-8ff878e72753 h1:FXipXC++4uw5v41AxCRFoxoGnQJBuEsObAy9q3a8uww=
github.com/jordanlewis/gcassert v0.0.0-20200630054945-8ff878e72753/go.mod h1:Qc93dJSt1iLNJCuG9Gy9ds0k/oh4ckhXGkD4AI3cEtM=
github.com/jordanlewis/gcassert v0.0.0-20200706043056-bf61eb72ee48 h1:d1Ov7s7RbMdHcgE1Eh1CxR+yd2TTKYOCHZf92Tm/fLs=
github.com/jordanlewis/gcassert v0.0.0-20200706043056-bf61eb72ee48/go.mod h1:Qc93dJSt1iLNJCuG9Gy9ds0k/oh4ckhXGkD4AI3cEtM=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
Expand Down Expand Up @@ -742,6 +742,8 @@ golang.org/x/tools v0.0.0-20200509030707-2212a7e161a5 h1:MeC2gMlMdkd67dn17MEby3r
golang.org/x/tools v0.0.0-20200509030707-2212a7e161a5/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200626171337-aa94e735be7f h1:JcoF/bowzCDI+MXu1yLqQGNO3ibqWsWq+Sk7pOT218w=
golang.org/x/tools v0.0.0-20200626171337-aa94e735be7f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200702044944-0cc1aa72b347 h1:/e4fNMHdLn7SQSxTrRZTma2xjQW6ELdxcnpqMhpo9X4=
golang.org/x/tools v0.0.0-20200702044944-0cc1aa72b347/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
Expand Down
1 change: 1 addition & 0 deletions pkg/col/coldata/bytes.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ func (b *Bytes) maybeBackfillOffsets(i int) {
// unsafe for reuse if any write operation happens.
// NOTE: if ith element was never set in any way, the behavior of Get is
// undefined.
//gcassert:inline
func (b *Bytes) Get(i int) []byte {
return b.data[b.offsets[i]:b.offsets[i+1]]
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/col/coldata/datum_vec.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ type Datum interface{}
// tree.Datums in the vectorized engine. In order to avoid import of 'tree'
// package the implementation of DatumVec lives in 'coldataext' package.
type DatumVec interface {
// Get returns the datum at index i in the vector.
// Get returns the datum at index i in the vector. The datum cannot be used
// anymore once the vector is modified.
Get(i int) Datum
// Set sets the datum at index i in the vector. It must check whether the
// provided datum is compatible with the type that the DatumVec stores.
Expand Down
32 changes: 24 additions & 8 deletions pkg/col/coldata/native_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,28 +41,44 @@ type Times []time.Time
// Durations is a slice of duration.Duration.
type Durations []duration.Duration

// Get returns the element at index idx of the vector.
// Get returns the element at index idx of the vector. The element cannot be
// used anymore once the vector is modified.
//gcassert:inline
func (c Bools) Get(idx int) bool { return c[idx] }

// Get returns the element at index idx of the vector.
// Get returns the element at index idx of the vector. The element cannot be
// used anymore once the vector is modified.
//gcassert:inline
func (c Int16s) Get(idx int) int16 { return c[idx] }

// Get returns the element at index idx of the vector.
// Get returns the element at index idx of the vector. The element cannot be
// used anymore once the vector is modified.
//gcassert:inline
func (c Int32s) Get(idx int) int32 { return c[idx] }

// Get returns the element at index idx of the vector.
// Get returns the element at index idx of the vector. The element cannot be
// used anymore once the vector is modified.
//gcassert:inline
func (c Int64s) Get(idx int) int64 { return c[idx] }

// Get returns the element at index idx of the vector.
// Get returns the element at index idx of the vector. The element cannot be
// used anymore once the vector is modified.
//gcassert:inline
func (c Float64s) Get(idx int) float64 { return c[idx] }

// Get returns the element at index idx of the vector.
// Get returns the element at index idx of the vector. The element cannot be
// used anymore once the vector is modified.
//gcassert:inline
func (c Decimals) Get(idx int) apd.Decimal { return c[idx] }

// Get returns the element at index idx of the vector.
// Get returns the element at index idx of the vector. The element cannot be
// used anymore once the vector is modified.
//gcassert:inline
func (c Times) Get(idx int) time.Time { return c[idx] }

// Get returns the element at index idx of the vector.
// Get returns the element at index idx of the vector. The element cannot be
// used anymore once the vector is modified.
//gcassert:inline
func (c Durations) Get(idx int) duration.Duration { return c[idx] }

// Len returns the length of the vector.
Expand Down
Loading

0 comments on commit 0a1a7c2

Please sign in to comment.