From 9ff04da0cf558cc56a5d3348116d1b1d59dbef41 Mon Sep 17 00:00:00 2001 From: Matthew Nibecker Date: Sat, 28 Sep 2024 14:51:33 -0400 Subject: [PATCH] vector: Remove unncessary Nulls is nil check (#5303) --- vector/array.go | 2 +- vector/bool.go | 2 +- vector/bytes.go | 2 +- vector/const.go | 2 +- vector/dict.go | 2 +- vector/error.go | 2 +- vector/float.go | 2 +- vector/int.go | 2 +- vector/ip.go | 2 +- vector/map.go | 2 +- vector/net.go | 2 +- vector/record.go | 2 +- vector/set.go | 2 +- vector/string.go | 2 +- vector/type.go | 2 +- vector/uint.go | 2 +- 16 files changed, 16 insertions(+), 16 deletions(-) diff --git a/vector/array.go b/vector/array.go index 2c454d5b2e..f6e0e0295f 100644 --- a/vector/array.go +++ b/vector/array.go @@ -27,7 +27,7 @@ func (a *Array) Len() uint32 { } func (a *Array) Serialize(b *zcode.Builder, slot uint32) { - if a.Nulls != nil && a.Nulls.Value(slot) { + if a.Nulls.Value(slot) { b.Append(nil) return } diff --git a/vector/bool.go b/vector/bool.go index 152c679621..2ca07ddcc2 100644 --- a/vector/bool.go +++ b/vector/bool.go @@ -48,7 +48,7 @@ func (b *Bool) CopyWithBits(bits []uint64) *Bool { } func (b *Bool) Serialize(builder *zcode.Builder, slot uint32) { - if b.Nulls != nil && b.Nulls.Value(slot) { + if b.Nulls.Value(slot) { builder.Append(nil) } else { builder.Append(zed.EncodeBool(b.Value(slot))) diff --git a/vector/bytes.go b/vector/bytes.go index e64bf8440a..15456ec9e4 100644 --- a/vector/bytes.go +++ b/vector/bytes.go @@ -39,7 +39,7 @@ func (b *Bytes) Serialize(builder *zcode.Builder, slot uint32) { } func (b *Bytes) Value(slot uint32) []byte { - if b.Nulls != nil && b.Nulls.Value(slot) { + if b.Nulls.Value(slot) { return nil } return b.Bytes[b.Offs[slot]:b.Offs[slot+1]] diff --git a/vector/const.go b/vector/const.go index 150be5a0e1..787499fd04 100644 --- a/vector/const.go +++ b/vector/const.go @@ -38,7 +38,7 @@ func (c *Const) Value() zed.Value { } func (c *Const) Serialize(b *zcode.Builder, slot uint32) { - if c.Nulls != nil && c.Nulls.Value(slot) { + if c.Nulls.Value(slot) { b.Append(nil) } else { b.Append(c.val.Bytes()) diff --git a/vector/dict.go b/vector/dict.go index 948697083f..19fe58f31b 100644 --- a/vector/dict.go +++ b/vector/dict.go @@ -22,7 +22,7 @@ func (d *Dict) Len() uint32 { } func (d *Dict) Serialize(builder *zcode.Builder, slot uint32) { - if d.Nulls != nil && d.Nulls.Value(slot) { + if d.Nulls.Value(slot) { builder.Append(nil) } else { d.Any.Serialize(builder, uint32(d.Index[slot])) diff --git a/vector/error.go b/vector/error.go index 1601b492b3..ec7a4a8f70 100644 --- a/vector/error.go +++ b/vector/error.go @@ -28,7 +28,7 @@ func (e *Error) Len() uint32 { } func (e *Error) Serialize(b *zcode.Builder, slot uint32) { - if e.Nulls != nil && e.Nulls.Value(slot) { + if e.Nulls.Value(slot) { b.Append(nil) return } diff --git a/vector/float.go b/vector/float.go index 1a7f941a3a..c55f7344f8 100644 --- a/vector/float.go +++ b/vector/float.go @@ -38,7 +38,7 @@ func (f *Float) Value(slot uint32) float64 { } func (f *Float) Serialize(b *zcode.Builder, slot uint32) { - if f.Nulls != nil && f.Nulls.Value(slot) { + if f.Nulls.Value(slot) { b.Append(nil) return } diff --git a/vector/int.go b/vector/int.go index 40d20dd332..2b5525c431 100644 --- a/vector/int.go +++ b/vector/int.go @@ -39,7 +39,7 @@ func (i *Int) Value(slot uint32) int64 { } func (i *Int) Serialize(b *zcode.Builder, slot uint32) { - if i.Nulls != nil && i.Nulls.Value(slot) { + if i.Nulls.Value(slot) { b.Append(nil) } else { b.Append(zed.EncodeInt(i.Values[slot])) diff --git a/vector/ip.go b/vector/ip.go index 5e238c6390..41bef40240 100644 --- a/vector/ip.go +++ b/vector/ip.go @@ -27,7 +27,7 @@ func (i *IP) Len() uint32 { } func (i *IP) Serialize(b *zcode.Builder, slot uint32) { - if i.Nulls != nil && i.Nulls.Value(slot) { + if i.Nulls.Value(slot) { b.Append(nil) } else { b.Append(zed.EncodeIP(i.Values[slot])) diff --git a/vector/map.go b/vector/map.go index 87dba652f3..bf46800728 100644 --- a/vector/map.go +++ b/vector/map.go @@ -28,7 +28,7 @@ func (m *Map) Len() uint32 { } func (m *Map) Serialize(b *zcode.Builder, slot uint32) { - if m.Nulls != nil && m.Nulls.Value(slot) { + if m.Nulls.Value(slot) { b.Append(nil) return } diff --git a/vector/net.go b/vector/net.go index 9e7210deaa..b72c1d64ae 100644 --- a/vector/net.go +++ b/vector/net.go @@ -27,7 +27,7 @@ func (n *Net) Len() uint32 { } func (n *Net) Serialize(b *zcode.Builder, slot uint32) { - if n.Nulls != nil && n.Nulls.Value(slot) { + if n.Nulls.Value(slot) { b.Append(nil) } else { b.Append(zed.EncodeNet(n.Values[slot])) diff --git a/vector/record.go b/vector/record.go index 5910ab5a26..e09e0357d3 100644 --- a/vector/record.go +++ b/vector/record.go @@ -27,7 +27,7 @@ func (r *Record) Len() uint32 { } func (r *Record) Serialize(b *zcode.Builder, slot uint32) { - if r.Nulls != nil && r.Nulls.Value(slot) { + if r.Nulls.Value(slot) { b.Append(nil) return } diff --git a/vector/set.go b/vector/set.go index 1aec61a482..1d3a653fa0 100644 --- a/vector/set.go +++ b/vector/set.go @@ -27,7 +27,7 @@ func (s *Set) Len() uint32 { } func (s *Set) Serialize(b *zcode.Builder, slot uint32) { - if s.Nulls != nil && s.Nulls.Value(slot) { + if s.Nulls.Value(slot) { b.Append(nil) return } diff --git a/vector/string.go b/vector/string.go index 8f5a42162b..9e0145f3fb 100644 --- a/vector/string.go +++ b/vector/string.go @@ -39,7 +39,7 @@ func (s *String) Value(slot uint32) string { } func (s *String) Serialize(b *zcode.Builder, slot uint32) { - if s.Nulls != nil && s.Nulls.Value(slot) { + if s.Nulls.Value(slot) { b.Append(nil) } else { b.Append(zed.EncodeString(s.Value(slot))) diff --git a/vector/type.go b/vector/type.go index 30aab7f51b..c28a2c2858 100644 --- a/vector/type.go +++ b/vector/type.go @@ -30,7 +30,7 @@ func (t *TypeValue) Value(slot uint32) []byte { } func (t *TypeValue) Serialize(b *zcode.Builder, slot uint32) { - if t.Nulls != nil && t.Nulls.Value(slot) { + if t.Nulls.Value(slot) { b.Append(nil) } else { b.Append(t.Value(slot)) diff --git a/vector/uint.go b/vector/uint.go index 6d3b93b0cb..6c747f47fa 100644 --- a/vector/uint.go +++ b/vector/uint.go @@ -39,7 +39,7 @@ func (u *Uint) Value(slot uint32) uint64 { } func (u *Uint) Serialize(b *zcode.Builder, slot uint32) { - if u.Nulls != nil && u.Nulls.Value(slot) { + if u.Nulls.Value(slot) { b.Append(nil) } else { b.Append(zed.EncodeUint(u.Values[slot]))