MCPcopy Create free account
hub / github.com/cockroachdb/cockroachdb-parser / Window

Method Window

pkg/col/coldata/vec.eg.go:1294–1422  ·  view source on GitHub ↗

Window returns a "window" into the Vec. A "window" is similar to Golang's slice of the current Vec from [start, end), but the returned object is NOT allowed to be modified (the modification might result in an undefined behavior).

(start int, end int)

Source from the content-addressed store, hash-verified

1292// allowed to be modified (the modification might result in an undefined
1293// behavior).
1294func (v *Vec) Window(start int, end int) *Vec {
1295 switch v.CanonicalTypeFamily() {
1296 case types.BoolFamily:
1297 switch v.t.Width() {
1298 case -1:
1299 default:
1300 col := v.Bool()
1301 return &Vec{
1302 t: v.t,
1303 canonicalTypeFamily: v.canonicalTypeFamily,
1304 col: col.Window(start, end),
1305 nulls: v.nulls.Slice(start, end),
1306 }
1307 }
1308 case types.BytesFamily:
1309 switch v.t.Width() {
1310 case -1:
1311 default:
1312 col := v.Bytes()
1313 return &Vec{
1314 t: v.t,
1315 canonicalTypeFamily: v.canonicalTypeFamily,
1316 col: col.Window(start, end),
1317 nulls: v.nulls.Slice(start, end),
1318 }
1319 }
1320 case types.DecimalFamily:
1321 switch v.t.Width() {
1322 case -1:
1323 default:
1324 col := v.Decimal()
1325 return &Vec{
1326 t: v.t,
1327 canonicalTypeFamily: v.canonicalTypeFamily,
1328 col: col.Window(start, end),
1329 nulls: v.nulls.Slice(start, end),
1330 }
1331 }
1332 case types.IntFamily:
1333 switch v.t.Width() {
1334 case 16:
1335 col := v.Int16()
1336 return &Vec{
1337 t: v.t,
1338 canonicalTypeFamily: v.canonicalTypeFamily,
1339 col: col.Window(start, end),
1340 nulls: v.nulls.Slice(start, end),
1341 }
1342 case 32:
1343 col := v.Int32()
1344 return &Vec{
1345 t: v.t,
1346 canonicalTypeFamily: v.canonicalTypeFamily,
1347 col: col.Window(start, end),
1348 nulls: v.nulls.Slice(start, end),
1349 }
1350 case -1:
1351 default:

Callers

nothing calls this directly

Calls 15

CanonicalTypeFamilyMethod · 0.95
BoolMethod · 0.95
BytesMethod · 0.95
DecimalMethod · 0.95
Int16Method · 0.95
Int32Method · 0.95
Int64Method · 0.95
Float64Method · 0.95
TimestampMethod · 0.95
IntervalMethod · 0.95
JSONMethod · 0.95
DatumMethod · 0.95

Tested by

no test coverage detected