Esempio n. 1
0
func (b *byteAccumulator) Accumulate(d encoding.Decoder, nullmask []bool, count uint) error {
	buff := make([][]byte, count)

	if b.size == 0 {
		read, err := d.DecodeByteArray(buff)
		if err != nil {
			return fmt.Errorf("%s.DecodeByteArray: %s", d, err)
		}
		if read != count {
			return fmt.Errorf("decodeByteArray: could not read all the expected values (%d) only %d", count, read)
		}
	} else {
		read, err := d.DecodeFixedByteArray(buff, uint(b.size))
		if err != nil {
			return fmt.Errorf("%v.DecodeFixedByteArray: %s", d, err)
		}
		if read != count {
			return fmt.Errorf("%s.DecodeFixedByteArray: could not read all the expected values (%d) only %d", count, d, read)
		}
	}

	b.buff = append(b.buff, buff...)
	b.nullmask = append(b.nullmask, nullmask...)

	return nil
}
Esempio n. 2
0
func (b *int64Accumulator) Accumulate(d encoding.Decoder, nullmask []bool, count uint) error {
	buff := make([]int64, count)
	read, err := d.DecodeInt64(buff)
	if err != nil {
		return fmt.Errorf("%#v: %s", d, err)
	}

	if read != count {
		return fmt.Errorf("could not read all the expected values (%d) only %d", count, read)
	}

	b.buff = append(b.buff, buff...)
	b.nullmask = append(b.nullmask, nullmask...)

	return nil
}