Type System

Overview

The figure below illustrates the type system at a glance:

type-system

There exist two major classes of types:

  1. Basic: types with static structure with a-priori known representation
  2. Recursive: types that can contain nested types
    • Container: vectors, sets, and tables
    • Compound: product types in the form of records with fields

Every type has zero or more attributes, which are free-form key-value pairs to further specify type semantics. For example, the #timestamp attribute (key only) marks a type as representative for the event timestamp.

Example

To illustrate how the type system interacts with table slices, consider the following example with an event layout (left) along with the corresponding table slice (right):

type-example

A table slice layout is always a record type whose fields map to column names. In this example, the record type has the name R and the record has three fields, A, B, and C. The type of A is time, which represents a point in time. It has the #timestamp attribute to indidcate that this column should represent the event timestamp. The last event added to this table slice was <2020-01-03, "baz", 4.2>.

Types

In the following we introduce the semantics of the various types, along with identifier and data instantiations that VAST uses in schema definitions and the query language.

Basic Types

IdentifierDescriptionExample Data
noneDenotes an absent or invalid valuenil
boolA boolean valueT, F
intA 64-bit signed integer-42, +3
countA 64-bit unsigned integer0, 42
realA 64-bit double (IEEE 754)-0.7, 1.337
durationA time span (nanosecond granularity)-3us, 24h
timeA time point (nanosecond granularity)now, 1h ago, 2020-01-01+10:42:00
stringA sequence of characters"foo"
patternA regular expression/fo*.bar$/
addrAn IPv4 or IPv6 address::1, 10.0.0.1, 2001:db8::
subnetAn IPv4 or IPv6 subnet::1/128, 10.0.0.0/8, 2001:db8::/32
portA transport-layer port and protocol53/udp, 80/tcp, 1337/?

Container Types

Container types can have zero or more values of a given type, but they count still as single value.

IdentifierDescriptionExample Data
vector<T>An (ordered) sequence of values where each element has type T[1, 2, 3], []
set<T>A set of (unique) values where each element has type T{x, y, z}, {}
map<K, V>An associate array which maps a keys of type K to values of type V{x -> a, y -> b, z -> c}, {-}

Compound Types

Currently, there exists only one compound type: the record types. It is product type, similar to a C struct or JSON record. By design, every table slice has a record as layout. Records consist of one or more fields, each of which have a name and a type.

Type Attributes

A type can have additional key-value pair attributes to enrich its semantics. VAST uses some attributes keys internally, e.g., #timestamp to indicate that this field denotes the event timestamp. Attributes have an optional value. For example, both #foo and #foo="bar" is a valid attribute.