The Arrow types a column can be
Two limits are worth stating because they surface as schema errors rather than
as documentation:
- A
mapwithkeys_sorted = trueis rejected. Sorted-key maps do not survive the round trip through the Python bindings, so they are refused rather than silently unsorted. - Not every type is legal as a
fixed_size_listchild. The vector case is, which is what matters in practice.
SQL names for Arrow types
DataFusion’s type reference
describes the full mapping.
Types SQL has no name for
Some column kinds have no SQL type name.Vectors
A dense vector column has a fixed dimension, commonly represented asFixedSizeList<Float32, dim>. Other supported vector element types are
possible; inspect the column with arrow_typeof rather than assuming Float32.
It is selectable and testable for nullness:
bfloat16
Sixteen-bit floats in the bfloat16 layout, stored asfixed_size_binary(2).
Useful as a vector element type when halving the memory matters more than the
precision does.
Pseudo-columns
Availability depends on the SQL table provider. The ordinary table provider exposes the stored dataset schema; naming a Lance scan metadata field does not make it available as a SQL column. Thefts() provider adds _score to
its schema, so _score is included in SELECT * FROM fts(...).
_rowid, _rowaddr, and _rowoffset describe Lance scan metadata, not
columns automatically registered on an ordinary SQL table. Select _score
from an fts() relation explicitly when you want a projection containing it.
Casting
TRY_CAST yields null rather than failing the query on a value that will not
convert. See Operators.