v2026.11.2
All Bundles
Bundle

In-memory query engine over typed columns. Tables are filled row by row or loaded from sources (CSV files, folders, the program's own objects) and queried with SQL-like statements; aggregates, Describe() and Finder (file search) are included. Compile with -lib query.

Column

One column of a table, held as a typed array rather than one object per cell. A column is either declared, in which case storing a value of the wrong type is refused, or inferred from its first value, in which case an Int widens into a Float column, a Float promotes an Int column to Float, and any other mix promotes the column to OBJECT so every value is kept as it was given. Empty cells are tracked in a bitmap allocated with the first one. Text columns store each distinct string once while they have few of them. Numeric and date columns keep the minimum and maximum of every 65,536-row group, so a filter can skip groups.

Operations

Append #

Adds an empty cell at the end. Used by Table.

method : public : Append() ~ Nil

Compact #

Keeps only the given rows, in order, and trims the arrays to fit. Used by Table->Compact.

method : public : Compact(keep:Int[]) ~ Nil

Parameters

NameTypeDescription
keepIntrows to keep, ascending

CopyFrom #

Copies a cell from another column, converting through Set when the types differ

method : public : CopyFrom(src:Column, src_row:Int, row:Int) ~ Bool

Parameters

NameTypeDescription
srcColumncolumn to copy from
src_rowIntrow in that column
rowIntrow in this column

Return

TypeDescription
Booltrue if stored

DictionaryLimit # function

Distinct strings a text column keeps in its dictionary before it may store plain strings

function : DictionaryLimit() ~ Int

Return

TypeDescription
Intdictionary size limit

FillInts #

Fills an empty INT column with values, none empty. Used by Table->Gather.

method : public : FillInts(values:Int[]) ~ Nil

Parameters

NameTypeDescription
valuesIntvalues

FillNulls #

Fills an empty column with n empty cells. Used by Table->Gather.

method : public : FillNulls(n:Int) ~ Nil

Parameters

NameTypeDescription
nIntnumber of rows

FillNumbers #

Refills a column with numbers. Used for query aggregates.

method : public : FillNumbers(type:ColumnType, ints:Int[], floats:Float[], present:Bool[]) ~ Nil

Parameters

NameTypeDescription
typeColumnTypeINT or FLOAT
intsIntvalues for an INT column
floatsFloatvalues for a FLOAT column
presentBoolfalse where a cell is empty

FindCode #

Gets the code of a string in an encoded column

method : public : FindCode(value:String) ~ Int

Parameters

NameTypeDescription
valueStringstring

Return

TypeDescription
Intcode, -1 if the column does not hold it or is not encoded

Gather #

Fills an empty column with copies of another column's cells, in the given order. The column takes the other's type. Used to copy query results.

method : public : Gather(src:Column, rows:Int[]) ~ Nil

Parameters

NameTypeDescription
srcColumncolumn to copy from
rowsIntits row slots to copy; -1 gives an empty cell

Get #

Gets a cell as an object: IntRef, FloatRef, String, Date, BoolRef or the stored object

method : public : Get(row:Int) ~ Compare

Parameters

NameTypeDescription
rowIntrow number

Return

TypeDescription
Comparevalue, Nil if empty

GetCode #

Gets the dictionary code of a cell in an encoded text column

method : public : GetCode(row:Int) ~ Int

Parameters

NameTypeDescription
rowIntrow number

Return

TypeDescription
Intcode, -1 if empty or not encoded

GetColumnIndex #

Gets the column's index. Used by Table and the query planner.

method : public : GetColumnIndex() ~ ColumnIndex

Return

TypeDescription
ColumnIndexindex, Nil if none

GetDictionary #

Gets the strings of an encoded STRING column, indexed by code

method : public : GetDictionary() ~ String[]

Return

TypeDescription
Stringdictionary, Nil if not encoded

GetDictionaryRanks #

Gets each dictionary code's position in sorted order, so encoded text sorts by number

method : public : GetDictionaryRanks() ~ Int[]

Return

TypeDescription
Intrank per code, Nil if not encoded

GetDictionarySize #

Gets the number of distinct strings in a dictionary-encoded column

method : public : GetDictionarySize() ~ Int

Return

TypeDescription
Intdictionary size, 0 if not encoded

GetError #

Gets the reason the last value was refused

method : public : GetError() ~ String

Return

TypeDescription
Stringerror, Nil if none

GetFloat #

Gets a numeric or date cell as a Float

method : public : GetFloat(row:Int) ~ Float

Parameters

NameTypeDescription
rowIntrow number

Return

TypeDescription
Floatvalue, 0.0 if empty or not numeric

GetFloatArray #

Gets the values of a FLOAT column, for code that scans the column directly

method : public : GetFloatArray() ~ Float[]

Return

TypeDescription
Floatvalues, Nil for other types

GetGmtBits #

Gets the array of 64-row words marking DATE cells stored as GMT dates

method : public : GetGmtBits() ~ Int[]

Return

TypeDescription
IntGMT bitmap

GetGroupCount #

Gets the number of zone-map groups

method : public : GetGroupCount() ~ Int

Return

TypeDescription
Intnumber of groups

GetGroupMax #

Gets the largest value in a group, ignoring empty cells

method : public : GetGroupMax(group:Int) ~ Float

Parameters

NameTypeDescription
groupIntgroup number

Return

TypeDescription
Floatmaximum (see GetGroupMin)

GetGroupMin #

Gets the smallest value in a group, ignoring empty cells

method : public : GetGroupMin(group:Int) ~ Float

Parameters

NameTypeDescription
groupIntgroup number

Return

TypeDescription
Floatminimum; for a group with no values the minimum is above the maximum (see GroupHasValues)

GetIndexKind #

Gets the kind of index the column has (see Table->CreateIndex)

method : public : GetIndexKind() ~ IndexKind

Return

TypeDescription
IndexKindHASH, SORTED, or NONE if it has none

GetIndexName #

Gets the name of the column's index

method : public : GetIndexName() ~ String

Return

TypeDescription
Stringindex name, Nil if it has none

GetInt #

Gets a cell of an INT, BOOL (0 or 1) or DATE (epoch milliseconds) column

method : public : GetInt(row:Int) ~ Int

Parameters

NameTypeDescription
rowIntrow number

Return

TypeDescription
Intvalue, 0 if empty

GetIntArray #

Gets the values of an INT, DATE or BOOL column, or the codes of an encoded STRING column, for code that scans the column directly

method : public : GetIntArray() ~ Int[]

Return

TypeDescription
Intvalues, Nil for other types

GetName #

Gets the column name

method : public : GetName() ~ String

Return

TypeDescription
Stringcolumn name

GetNullBits #

Gets the array of 64-row words marking empty cells, for code that scans the column directly. Valid until the column next grows or changes type.

method : public : GetNullBits() ~ Int[]

Return

TypeDescription
Intnull bitmap

GetNullCount #

Gets the number of empty cells

method : public : GetNullCount() ~ Int

Return

TypeDescription
Intnumber of empty cells

GetObjectArray #

Gets the values of an OBJECT column

method : public : GetObjectArray() ~ Compare[]

Return

TypeDescription
Comparevalues, Nil for other types

GetPromotions #

Gets how many times the column changed type to keep a value

method : public : GetPromotions() ~ Int

Return

TypeDescription
Intnumber of promotions

GetString #

Gets a cell of a STRING column

method : public : GetString(row:Int) ~ String

Parameters

NameTypeDescription
rowIntrow number

Return

TypeDescription
Stringvalue, Nil if empty or not a text column

GetStringArray #

Gets the values of a plain (not encoded) STRING column

method : public : GetStringArray() ~ String[]

Return

TypeDescription
Stringvalues, Nil for other columns

GetType #

Gets the storage type

method : public : GetType() ~ ColumnType

Return

TypeDescription
ColumnTypestorage type

GmtAt #

Whether a DATE cell was stored as a GMT date

method : public : GmtAt(row:Int) ~ Bool

Parameters

NameTypeDescription
rowIntrow number

Return

TypeDescription
Booltrue if GMT

GroupHasValues #

Whether a group holds any non-empty value

method : public : GroupHasValues(group:Int) ~ Bool

Parameters

NameTypeDescription
groupIntgroup number

Return

TypeDescription
Booltrue if the group has values

GroupRows # function

Rows in a zone-map group

function : GroupRows() ~ Int

Return

TypeDescription
Introws per group

HasZones #

Whether the column keeps zone maps: INT, FLOAT and DATE columns do

method : public : HasZones() ~ Bool

Return

TypeDescription
Booltrue if zone maps are kept

IndexDeleted #

Tells the column's index that a row was deleted from its table. Used by Table->Delete.

method : public : IndexDeleted(row:Int) ~ Nil

Parameters

NameTypeDescription
rowIntrow slot

IsDeclared #

Whether the column's type was declared, so mismatched values are refused

method : public : IsDeclared() ~ Bool

Return

TypeDescription
Booltrue if declared

IsEncoded #

Whether a text column stores its values as dictionary codes

method : public : IsEncoded() ~ Bool

Return

TypeDescription
Booltrue if dictionary encoded

IsNull #

Whether a cell is empty

method : public : IsNull(row:Int) ~ Bool

Parameters

NameTypeDescription
rowIntrow number

Return

TypeDescription
Booltrue if empty or out of range

IsNumeric #

Whether a cell holds a number an aggregate can use: an Int or a Float

method : public : IsNumeric(row:Int) ~ Bool

Parameters

NameTypeDescription
rowIntrow number

Return

TypeDescription
Booltrue if numeric

KindOf # function

Gets the storage type a value calls for

function : KindOf(value:Compare) ~ ColumnType

Parameters

NameTypeDescription
valueComparevalue

Return

TypeDescription
ColumnTypestorage type

New # constructor

Constructor

New(name:String, type:ColumnType, declared:Bool)

Parameters

NameTypeDescription
nameStringcolumn name
typeColumnTypestorage type; NONE takes the type of the first value stored
declaredBooltrue to refuse values of another type

Restore #

Refills a column with stored arrays, as an .otab file holds them. Used by OtabFile.

method : public : Restore(type:ColumnType, declared:Bool, n:Int, ints:Int[], floats:Float[], strings:String[], objects:Compare[], nulls:Int[], null_count:Int, gmt:Int[], encoded:Bool, dict:String[]) ~ Nil

Parameters

NameTypeDescription
typeColumnTypecolumn type
declaredBooltrue to refuse values of another type afterwards
nIntrows
intsIntINT, BOOL and DATE values, or dictionary codes of an encoded STRING column
floatsFloatFLOAT values
stringsStringplain STRING values
objectsCompareOBJECT values
nullsIntnull bitmap
null_countIntempty cells
gmtIntDATE GMT bitmap
encodedBooltrue if a STRING column is dictionary encoded
dictStringdictionary of an encoded STRING column

Set #

Stores a value. Nil empties the cell.

method : public : Set(row:Int, value:Compare) ~ Bool

Parameters

NameTypeDescription
rowIntrow number
valueComparevalue

Return

TypeDescription
Booltrue if stored, false if out of range or refused by a declared type (see GetError)

SetColumnIndex #

Gives the column an index, or takes it away. Used by Table->CreateIndex and DropIndex.

method : public : SetColumnIndex(index:ColumnIndex) ~ Nil

Parameters

NameTypeDescription
indexColumnIndexindex, Nil for none

Size #

Gets the number of rows, empty ones included

method : public : Size() ~ Int

Return

TypeDescription
Intnumber of rows

TypeName # function

Gets the name of a type

function : TypeName(type:ColumnType) ~ String

Parameters

NameTypeDescription
typeColumnTypestorage type

Return

TypeDescription
Stringlowercase type name