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.
OtabFile
An .otab file, or an .otab image in memory, opened for reading. Opening reads only the footer; Read then takes just the columns asked for, each checked against its CRC32, and GetBytesRead tells how much a read touched.
Example
file := OtabFile->New("runs.otab");
if(file->IsOpen()) {
scores := file->Read(["id", "score"]);
};Operations
- New
- GetBytesRead
- GetColumnNames
- GetError
- GetFormatVersion
- GetGroupCount
- GetIndexNames
- GetName
- GetRequests
- IsOpen
- Read
- Size
GetBytesRead #
Gets how many bytes reads have taken so far, the header, trailer and footer included
method : public : GetBytesRead() ~ IntReturn
| Type | Description |
|---|---|
| Int | bytes read |
GetColumnNames #
Gets the saved column names, without the key column
method : public : GetColumnNames() ~ String[]Return
| Type | Description |
|---|---|
| String | names |
GetError #
Gets why opening or the last read failed
method : public : GetError() ~ StringReturn
| Type | Description |
|---|---|
| String | error, Nil if none |
GetFormatVersion #
Gets the file's format version: 1, or 2 for a file that stores index definitions
method : public : GetFormatVersion() ~ IntReturn
| Type | Description |
|---|---|
| Int | version, 0 if the file did not open |
GetGroupCount #
Gets the number of row groups
method : public : GetGroupCount() ~ IntReturn
| Type | Description |
|---|---|
| Int | row groups |
GetIndexNames #
Gets the names of the indexes the file defines, which Read restores on the columns it reads
method : public : GetIndexNames() ~ String[]Return
| Type | Description |
|---|---|
| String | index names, in column order |
GetName #
Gets the table's name as saved
method : public : GetName() ~ StringReturn
| Type | Description |
|---|---|
| String | name |
GetRequests #
Gets the number of HTTP requests made for a file read by URL
method : public : GetRequests() ~ IntReturn
| Type | Description |
|---|---|
| Int | requests, 0 for a local file or image |
IsOpen #
Whether the file opened; GetError says why not
method : public : IsOpen() ~ BoolReturn
| Type | Description |
|---|---|
| Bool | true if open |
New # constructor
Opens a file, reading only its trailer and footer. A path that starts with http:// or https:// is read over HTTP: with range requests when the server supports them, so only the footer and the blocks a Read asks for cross the network, and otherwise by downloading the file once.
New(path:String)Parameters
| Name | Type | Description |
|---|---|---|
| path | String | .otab file, or its URL |
New # constructor
Opens an .otab image held in memory, as Table->ToBytes makes it
New(bytes:Byte[])Parameters
| Name | Type | Description |
|---|---|---|
| bytes | Byte | image |
Read #
Reads every column
method : public : Read() ~ TableReturn
| Type | Description |
|---|---|
| Table | table, Nil on error (see GetError) |