MCPcopy Create free account
hub / github.com/apache/iotdb-client-go / buildNullIndicatorBytes

Function buildNullIndicatorBytes

client/column_decoder_test.go:28–50  ·  view source on GitHub ↗
(nulls []bool)

Source from the content-addressed store, hash-verified

26)
27
28func buildNullIndicatorBytes(nulls []bool) []byte {
29 var buf bytes.Buffer
30 hasNull := false
31 for _, n := range nulls {
32 if n {
33 hasNull = true
34 break
35 }
36 }
37 if !hasNull {
38 buf.WriteByte(0)
39 return buf.Bytes()
40 }
41 buf.WriteByte(1)
42 packed := make([]byte, (len(nulls)+7)/8)
43 for i, n := range nulls {
44 if n {
45 packed[i/8] |= 0b10000000 >> (uint(i) % 8)
46 }
47 }
48 buf.Write(packed)
49 return buf.Bytes()
50}
51
52func TestBinaryArrayColumnDecoder_EmptyString(t *testing.T) {
53 var buf bytes.Buffer

Calls 1

WriteMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…