filter

package
v0.0.0-...-9bd9f91 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 5, 2024 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Overview

Package filter provides some functions for processing parquet RLE or bitpacked data or uint array.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Expand

func Expand[T DataUnit](s *Context, data []T, set BitSet) (result []T, err error)

Expand generates an array in which the elements in the data are placed according to 1 bits in the set.

func ExtractRLE

func ExtractRLE[T DataUnit](s *Context, size int, data []byte, r Range[uint32]) (result []T, err error)

ExtractRLE extract specified range of data.

func Ready

func Ready() bool

Ready returns true if the device is ready

func Select

func Select[T DataUnit](s *Context, data []T, set BitSet) (result []T, err error)

Select selects the elements in the data whose indices correspond to 1-bits in the set

Types

type BitSet

type BitSet []byte

BitSet is a fixed-size collection of bits that can be manipulated individually. It is a data structure that is used to represent a set of elements, where each element is represented by a single bit.

func Scan

func Scan[R DataUnit](s *Context, input []R, r Range[R]) (output BitSet, err error)

Scan scans the input for values within the specified range

func (BitSet) OnesCount

func (b BitSet) OnesCount() int

OnesCount returns the number of one bits ("population count") in b.

func (BitSet) Size

func (b BitSet) Size() int

Size return the min bitset size

func (BitSet) String

func (b BitSet) String() string

String returns a string representation of the bit set

type Context

type Context struct {
	// contains filtered or unexported fields
}

Context is used to store filters state.

func NewContext

func NewContext() (*Context, error)

NewContext returns a new context

func (*Context) ScanBitPacking

func (s *Context) ScanBitPacking(r Range[uint32], w int, size int, data []byte) (output BitSet, err error)

ScanBitPacking scans the input using bit packing

func (*Context) ScanRLE

func (s *Context) ScanRLE(r Range[uint32], size int, data []byte) (output BitSet, err error)

ScanRLE scans the input using run-length encoding

type DataUnit

type DataUnit interface {
	uint8 | uint16 | uint32
}

DataUnit represents a type that can be used in filter operations

type Range

type Range[R DataUnit] struct {
	Min, Max R
}

Range represents a range of values

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL