Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Data Types

Neumann has two layers of types: scalar values for individual fields and tensor values for composite storage.


Scalar Types

ScalarValue represents a single value in the system.

TypeDescriptionExamples
NullAbsence of a valueNULL
BoolBooleanTRUE, FALSE
Int64-bit signed integer42, -1, 0
Float64-bit floating point3.14, -0.5, 1e10
StringUTF-8 text'hello', 'Alice'
BytesRaw binary data(used internally for blob content)

Literals

  • Strings: Single-quoted: 'hello world'
  • Integers: Unquoted numbers: 42, -7
  • Floats: Numbers with decimal or exponent: 3.14, 1e-5
  • Booleans: TRUE or FALSE (case-insensitive)
  • Null: NULL
  • Arrays: Square brackets: [1, 2, 3] or [0.1, 0.2, 0.3]

Tensor Types

TensorValue wraps scalar values with vector and pointer types for the unified data model.

TypeDescriptionUse Case
Scalar(ScalarValue)Single scalar valueTable columns, node properties
Vector(Vec<f32>)Dense float vectorEmbeddings for similarity search
Sparse(SparseVector)Sparse vectorMemory-efficient high-dimensional embeddings
Pointer(String)Reference to another entityGraph edges, foreign keys
Pointers(Vec<String>)Multiple referencesMulti-valued relationships

Column Types in CREATE TABLE

When creating relational tables, use SQL-style type names. These map to internal scalar types.

SQL TypeInternal TypeNotes
INT, INTEGERInt64-bit signed integer
BIGINTIntSame as INT (64-bit)
SMALLINTIntSame as INT (64-bit)
FLOATFloat64-bit floating point
DOUBLEFloatSame as FLOAT
REALFloatSame as FLOAT
DECIMAL(p,s)FloatPrecision and scale are advisory
NUMERIC(p,s)FloatSame as DECIMAL
VARCHAR(n)StringMax length is advisory
CHAR(n)StringFixed-width (padded)
TEXTStringUnlimited length
BOOLEANBoolTRUE or FALSE
DATEStringStored as ISO-8601 string
TIMEStringStored as ISO-8601 string
TIMESTAMPStringStored as ISO-8601 string
BLOBBytesRaw binary data
custom nameStringAny unrecognized type stores as String

Type Coercion

Neumann performs implicit type coercion in comparisons:

  • Int and Float in arithmetic: Int is promoted to Float
  • String comparisons: lexicographic ordering
  • Null propagation: any operation with NULL yields NULL
  • Boolean context: only Bool values are truthy/falsy (no implicit conversion from Int)

Vector Representation

Dense vectors are stored as Vec<f32> and used for similarity search via HNSW indexes. All vectors in a collection must have the same dimensionality.

EMBED STORE 'doc1' [0.1, 0.2, 0.3, 0.4]

Sparse vectors use a compact representation storing only non-zero indices and values, making them efficient for high-dimensional data (e.g., 30,000+ dimensions for bag-of-words models).


Identifiers

Identifiers (table names, column names, labels) follow these rules:

  • Start with a letter or underscore
  • Contain letters, digits, and underscores
  • Case-insensitive for keywords, case-preserving for identifiers
  • No quoting required for simple names
  • Use single quotes for string values: 'value'