Bat

This module contains commands and patterns to manage Binary Association Tables (BATs). The list of commands include BAT updates, property management, persistence, candidate list manipulation and storage options. For relational algebra operators, use the algebra module.

MODULE bat;

COMMAND bat.append(X_0:bat[:any_1], X_1:bat[:any_1], X_2:bat[:oid], X_3:bit):bat[:any_1];
COMMENT "append the content of u with candidate list s to i";

COMMAND bat.append(X_0:bat[:any_1], X_1:bat[:any_1], X_2:bat[:oid]):bat[:any_1];
COMMENT "append the content of u with candidate list s to i";

COMMAND bat.append(X_0:bat[:any_1], X_1:bat[:any_1], X_2:bit):bat[:any_1];
COMMENT "append the content of u to i";

COMMAND bat.append(X_0:bat[:any_1], X_1:any_1, X_2:bit):bat[:any_1];
COMMENT "append the value u to i";

COMMAND bat.append(X_0:bat[:any_1], X_1:any_1):bat[:any_1];
COMMENT "append the value u to i";

COMMAND bat.append(X_0:bat[:any_1], X_1:bat[:any_1]):bat[:any_1];
COMMENT "append the content of u to i";

PATTERN bat.appendBulk(X_0:bat[:any_1], X_1:bit, X_2:any_1...):bat[:any_1];
COMMENT "append the arguments ins to i";

PATTERN bat.appendBulk(X_0:bat[:any_1], X_1:bit, X_2:bat[:any_1]...):bat[:any_1];
COMMENT "append the arguments ins to i";

COMMAND bat.attach(X_0:int, X_1:str):bat[:any_1];
COMMENT "Returns a new BAT with dense head and tail of the given type and uses\nthe given file to initialize the tail. The file will be owned by the\nserver.";

COMMAND bat.delete(X_0:bat[:any_1], X_1:oid):bat[:any_1];
COMMENT "Delete BUN indicated by head value, exchanging with last BUN";

COMMAND bat.delete(X_0:bat[:any_1]):bat[:any_1];
COMMENT "Delete all entries.";

COMMAND bat.delete(X_0:bat[:any_1], X_1:bat[:oid]):bat[:any_1];
COMMENT "Delete multiple BUN, shifting BUNs up";

COMMAND bat.densebat(X_0:lng):bat[:oid];
COMMENT "Creates a new [void,void] BAT of size 'sz'.";

COMMAND bat.diffcand(X_0:bat[:oid], X_1:bat[:oid]):bat[:oid];
COMMENT "Calculate difference of two candidate lists";

COMMAND bat.getAccess(X_0:bat[:any_1]):str;
COMMENT "Return the access mode attached to this BAT as a character.";

COMMAND bat.getCapacity(X_0:bat[:any_1]):lng;
COMMENT "Returns the current allocation size (in max number of elements) of a BAT.";

COMMAND bat.getColumnType(X_0:bat[:any_1]):str;
COMMENT "Returns the type of the tail column of a BAT, as an integer type number.";

COMMAND bat.getName(X_0:bat[:any_1]):str;
COMMENT "Gives back the logical name of a BAT.";

COMMAND bat.getRole(X_0:bat[:any_1]):str;
COMMENT "Returns the rolename of the head column of a BAT.";

COMMAND bat.getSequenceBase(X_0:bat[:any_1]):oid;
COMMENT "Get the sequence base for the void column of a BAT.";

COMMAND bat.getSize(X_0:bat[:any_1]):lng;
COMMENT "Calculate the actual size of the BAT descriptor, heaps, hashes and imprint indices in bytes\nrounded to the memory page size (see bbp.getPageSize()).";

COMMAND bat.getVHeapSize(X_0:bat[:any_1]):lng;
COMMENT "Calculate the vheap size for varsized bats";

PATTERN bat.getorderidx(X_0:bat[:any_1]):bat[:oid];
COMMENT "Return the order index if it exists";

PATTERN bat.hasorderidx(X_0:bat[:any_1]):bit;
COMMENT "Return true if order index exists";

COMMAND bat.imprints(X_0:bat[:bte]):void;
COMMENT "";

COMMAND bat.imprints(X_0:bat[:dbl]):void;
COMMENT "Check for existence or create an imprint index on the BAT.";

COMMAND bat.imprints(X_0:bat[:flt]):void;
COMMENT "";

COMMAND bat.imprints(X_0:bat[:int]):void;
COMMENT "";

COMMAND bat.imprints(X_0:bat[:lng]):void;
COMMENT "";

COMMAND bat.imprints(X_0:bat[:sht]):void;
COMMENT "";

COMMAND bat.imprintsize(X_0:bat[:bte]):lng;
COMMENT "";

COMMAND bat.imprintsize(X_0:bat[:dbl]):lng;
COMMENT "Return the storage size of the imprints index structure.";

COMMAND bat.imprintsize(X_0:bat[:flt]):lng;
COMMENT "";

COMMAND bat.imprintsize(X_0:bat[:int]):lng;
COMMENT "";

COMMAND bat.imprintsize(X_0:bat[:lng]):lng;
COMMENT "";

COMMAND bat.imprintsize(X_0:bat[:sht]):lng;
COMMENT "";

COMMAND bat.info(X_0:bat[:any_1]) (X_1:bat[:str], X_2:bat[:str]);
COMMENT "Produce a table containing information about a BAT in [attribute,value] format. \nIt contains all properties of the BAT record.";

COMMAND bat.intersectcand(X_0:bat[:oid], X_1:bat[:oid]):bat[:oid];
COMMENT "Intersect two candidate lists into one";

COMMAND bat.isPersistent(X_0:bat[:any_1]):bit;
COMMENT "";

COMMAND bat.isSorted(X_0:bat[:any_1]):bit;
COMMENT "Returns true if BAT values are ordered.";

COMMAND bat.isSortedReverse(X_0:bat[:any_1]):bit;
COMMENT "Returns true if BAT values are reversely ordered.";

COMMAND bat.isSynced(X_0:bat[:any_1], X_1:bat[:any_2]):bit;
COMMENT "Tests whether two BATs are synced or not.";

COMMAND bat.isTransient(X_0:bat[:any_1]):bit;
COMMENT "";

COMMAND bat.isaKey(X_0:bat[:any_1]):bit;
COMMENT "Return whether the column tail values are unique (key).";

COMMAND bat.mergecand(X_0:bat[:oid], X_1:bat[:oid]):bat[:oid];
COMMENT "Merge two candidate lists into one";

COMMAND bat.mirror(X_0:bat[:any_2]):bat[:oid];
COMMENT "Returns the head-mirror image of a BAT (two head columns).";

PATTERN bat.new(X_0:any_1, X_1:bat[:any_2]):bat[:any_1];
COMMENT "Creates a new empty transient BAT, with tail-type tt and hseqbase and size from the input bat argument.";

PATTERN bat.new(X_0:any_1):bat[:any_1];
COMMENT "";

PATTERN bat.new(X_0:any_1, X_1:int):bat[:any_1];
COMMENT "";

PATTERN bat.new(X_0:any_1, X_1:int, X_2:bit):bat[:any_1];
COMMENT "";

PATTERN bat.new(X_0:any_1, X_1:lng):bat[:any_1];
COMMENT "Creates a new empty transient BAT, with tail-types as indicated.";

PATTERN bat.new(X_0:any_1, X_1:lng, X_2:bit):bat[:any_1];
COMMENT "";

PATTERN bat.orderidx(X_0:bat[:any_1]):void;
COMMENT "Introduces the OID index arrangement of ordered values";

PATTERN bat.orderidx(X_0:bat[:any_1], X_1:int):void;
COMMENT "Introduces the OID index arrangement of ordered values";

PATTERN bat.orderidx(X_0:bat[:any_1], X_1:bat[:any_1]...):void;
COMMENT "Consolidates the OID index arrangement";

PATTERN bat.pack(X_0:any_2...):bat[:any_2];
COMMENT "Materialize the values into a BAT. Avoiding a clash with mat.pack() in mergetable";

PATTERN bat.partition(X_0:bat[:any_1], X_1:int, X_2:int):bat[:any_1];
COMMENT "Create the n-th slice over the BAT broken into several pieces.";

PATTERN bat.partition(X_0:bat[:any_1]):bat[:any_1]...;
COMMENT "Create a serie of slices over the BAT argument. The BUNs are distributed evenly.";

COMMAND bat.replace(X_0:bat[:any_1], X_1:bat[:oid], X_2:bat[:any_1]):bat[:any_1];
COMMENT "Perform replace for all BUNs of the second BAT into the first.";

COMMAND bat.replace(X_0:bat[:any_1], X_1:bat[:oid], X_2:bat[:any_1], X_3:bit):bat[:any_1];
COMMENT "Perform replace for all BUNs of the second BAT into the first.";

COMMAND bat.replace(X_0:bat[:any_1], X_1:oid, X_2:any_1):bat[:any_1];
COMMENT "Replace the tail value of one BUN that has some head value.";

COMMAND bat.replace(X_0:bat[:any_1], X_1:oid, X_2:any_1, X_3:bit):bat[:any_1];
COMMENT "Replace the tail value of one BUN that has some head value.";

COMMAND bat.reuse(X_0:bat[:any_1], X_1:bat[:oid]):bat[:any_1];
COMMENT "Shuffle the values around to restore a dense representation of buns.";

COMMAND bat.reuseMap(X_0:bat[:any_1], X_1:bat[:oid]):bat[:oid];
COMMENT "Derive the oid mapping for reuse BAT based on list of to-be-deleted";

COMMAND bat.save(X_0:bat[:any_1]):void;
COMMENT "";

COMMAND bat.save(X_0:str):bit;
COMMENT "Save a BAT to storage, if it was loaded and dirty.  \nReturns whether IO was necessary.  Please realize that \ncalling this function violates the atomic commit protocol!!";

COMMAND bat.setAccess(X_0:bat[:any_1], X_1:str):bat[:any_1];
COMMENT "Try to change the update access privileges \nto this BAT. Mode:\nr[ead-only]      - allow only read access.\na[append-only]   - allow reads and update.\nw[riteable]      - allow all operations.\nBATs are updatable by default. On making a BAT read-only, \nall subsequent updates fail with an error message.\nReturns the BAT itself.";

COMMAND bat.setColumn(X_0:bat[:any_1], X_1:str):void;
COMMENT "Give a logical name to the tail column of a BAT.";

COMMAND bat.setHash(X_0:bat[:any_1]):bit;
COMMENT "Create a hash structure on the column";

COMMAND bat.setImprints(X_0:bat[:any_1]):bit;
COMMENT "Create an imprints structure on the column";

COMMAND bat.setName(X_0:bat[:any_1], X_1:str):void;
COMMENT "Give a logical name to a BAT.";

COMMAND bat.setPersistent(X_0:bat[:any_1]):void;
COMMENT "Make the BAT persistent.";

COMMAND bat.setTransient(X_0:bat[:any_1]):void;
COMMENT "Make the BAT transient.  Returns \nboolean which indicates if the\nBAT administration has indeed changed.";

PATTERN bat.single(X_0:any_1):bat[:any_1];
COMMENT "Create a BAT with a single elemenet";

COMMAND bat.vacuum(X_0:bat[:str]):bat[:str];
COMMENT "";

BAT multiplexing (should go to other file)

MODULE mal;

PATTERN mal.manifold(X_0:str, X_1:str, X_2:any...):bat[:any];
COMMENT "";

PATTERN mal.multiplex(X_0:lng, X_1:str, X_2:str):any...;
COMMENT "";

PATTERN mal.multiplex(X_0:lng, X_1:str, X_2:str, X_3:any...):any...;
COMMENT "";

PATTERN mal.multiplex(X_0:str, X_1:str, X_2:any...):any...;
COMMENT "";