func (f *RequiredField) DoWrite(w io.Writer, meta *Metadata, vals []byte, count int, stats Stats) error {
	buff := buffpool.Get()
	defer buffpool.Put(buff)
	l, cl, vals, err := compress(f.compression, buff, vals)
	if err != nil {
		return err
	}
	if err := meta.WritePageHeader(w, f.pth, l, cl, count, count, 0, 0, f.compression, stats); err != nil {
		return err
	}
	_, err = w.Write(vals)
	return err
}
DoWrite writes the actual raw data.
package parquet
import (
	"bytes"
	"compress/gzip"
	"math/bits"
	"strings"
	"github.com/valyala/bytebufferpool"
	"fmt"
	"io"
	"github.com/golang/snappy"
	"github.com/parsyl/parquet/internal/rle"
	sch "github.com/parsyl/parquet/schema"
)
type RepetitionType int
const (
	Unseen   RepetitionType = -1
	Required RepetitionType = 0
	Optional RepetitionType = 1
	Repeated RepetitionType = 2
)
var (
	buffpool = bytebufferpool.Pool{}
)
type RepetitionTypes []RepetitionType
func (r RepetitionTypes) MaxDef() uint8 {
	var out uint8
	for _, rt := range r {
		if rt == Optional || rt == Repeated {
			out++
		}
	}
	return out
}
func (r RepetitionTypes) MaxRep() uint8 {
	var out uint8
	for _, rt := range r {
		if rt == Repeated {
			out++
		}
	}
	return out
}
type RequiredField struct {
	pth         []string
	compression sch.CompressionCodec
}
func NewRequiredField(pth []string, opts ...func(*RequiredField)) RequiredField {
	r := RequiredField{
		pth:         pth,
		compression: sch.CompressionCodec_SNAPPY,
	}
	for _, opt := range opts {
		opt(&r)
	}
	return r
}
func RequiredFieldSnappy(r *RequiredField) {
	r.compression = sch.CompressionCodec_SNAPPY
}
func RequiredFieldGzip(r *RequiredField) {
	r.compression = sch.CompressionCodec_GZIP
}
func RequiredFieldUncompressed(r *RequiredField) {
	r.compression = sch.CompressionCodec_UNCOMPRESSED
}