ddn.columnar.types
The logical types of ddn.df: Kind, TimeUnit, DataType, the physical and logical type maps, the supported element types and the arithmetic supertype (D4, D5; ADR-2026-10-18-03).
Copyright
Types 13
Logical type kind of a DataType (D4, ADR-2026-10-18-03).
Resolution of a temporal kind. Phase 1 fixes NANOSECONDS, which is what Timestamp stores; the enum exists so later kinds (microseconds, days) do not break user switches.
A logical type: the kind plus its parameters (D4, ADR-2026-10-18-03). Starting from a bare Kind enum and switching to a parameterised struct later would break every user switch; a struct whose parameter-less kinds read like enum members (DataType.INT64) costs nothing. POD, 2 bytes, usable as an associative-array key and in a final switch (dtype.kind). The parameter metadata of the richer kinds (ADR-2026-10-23-13): null (meta is null) for the fourteen flat kinds. GC-owned, so children and dictionaries share the chunk model's lifetime automatically.
Kind elementLIST: the child element's kind (flat kinds in this tier; nested lists would need a deeper structure).string[] fieldsSTRUCT: the ordered field names (`fields.length` children).Kind dictionaryCATEGORICAL: the labels' kind (STRING in this tier).ubyte precisionDECIMAL: storage digits, one of 2, 4, 9, 18, 38.ubyte scaleDECIMAL: fraction digits (`0 .. precision`).TypeMeta ofCategorical(DataType dictionary) static @safe pure nothrowThe CATEGORICAL metadata constructor.Kind kindThe logical kind.TimeUnit unitTemporal resolution; only `TimeUnit.NANOSECONDS` exists in phase 1.TypeMeta metaThe richer kinds' parameter metadata; `null` for flat kinds (ADR-2026-10-23-13).DataType BOOLEANThe BOOLEAN type.DataType INT8The INT8 type.DataType INT16The INT16 type.DataType INT32The INT32 type.DataType INT64The INT64 type.DataType UINT8The UINT8 type.DataType UINT16The UINT16 type.DataType UINT32The UINT32 type.DataType UINT64The UINT64 type.DataType FLOAT32The FLOAT32 type.DataType FLOAT64The FLOAT64 type.DataType STRINGThe STRING type (UTF-8, large-offset layout).DataType DATETIMEThe DATETIME type (nanoseconds since the Unix epoch).DataType TIMEThe TIME type (nanoseconds of day).DataType DATEThe DATE type (i32 days since the epoch; ADR-2026-10-30-02).DataType DURATIONThe DURATION type (i64 fixed nanoseconds; ADR-2026-10-30-02).bool opEquals(const DataType other) const @safe pure nothrowLogical equality: same kind and same unit, independent of how the value was constructed.size_t toHash() const @safe pure nothrowHash consistent with `opEquals`, so `DataType` works as an associative-array key.string toString() const @safe pure nothrowRenders the type for display: the kind name (`"INT64"`, `"DATETIME"`). The unit is fixed in phase 1 and not printed.bool isNumeric() const @safe pure nothrowReturns: `true` for the integer and float kinds (not BOOLEAN).How Series.fillNull replaces null slots.
The frame-level null-drop criterion (DataFrame.dropNulls).
The regex replacement scope (strReplaceRegex).
A calendar date: days since the Unix epoch, i32, proleptic Gregorian (ADR-2026-10-30-02) - the element type of DATE columns (the Arrow date32 shape). No timezone, no time of day.
int daysDays since 1970-01-01 (negative before the epoch).Date fromYMD(long year, uint month, uint day) static @safe pureConstructs from calendar parts, validated (the proleptic Gregorian calendar: `month` 1..12, `day` 1..the month's length with leap years).void toYMD(out long year, out uint month, out uint day) const @safe pure nothrowThe civil parts (Howard Hinnant's civil-from-days; the same algorithm the UTC accessors use, correct for pre-epoch days).Date ofTimestamp(Timestamp t) static @safe pureThe date of the instant `t` (floor toward negative infinity - pre-epoch instants stay on their day).string toString() const @safe pure nothrowRenders as strict ISO `YYYY-MM-DD` (zero-padded four-digit year; a leading `-` for negative years beyond four digits).Every Kind, in declaration order (the static foreach sequence). The flat kinds: every pre-Tier-3 consumer's dispatch domain. The richer kinds (LIST, STRUCT, CATEGORICAL, DECIMAL) dispatch through their own layers and take explicit unsupported rejections in the final switches (ADR-2026-10-23-13).
Every kind, flat and rich - for metadata/render tests.
The numeric Kinds: the integers and floats, without BOOLEAN.
The calendar unit (truncateCalendar; ADR-2026-10-30-02).
The between range closure (ADR-2026-10-30-02).
Functions 17
long durNanos(long v) @safe pure nothrow @nogcThe semantic duration constructors (ADR-2026-10-30-02): the DURATION element type is plain `long` nanoseconds - these name the units. Every product wraps like D (`durDays(long.max)` wraps).long durDays(long v) @safe pure nothrow @nogcDitto, days (86 400 seconds exactly - fixed lengths).bool isSignedKind(Kind k) @safe pure nothrowReturns: `true` for the signed and unsigned integer kinds.ushort widthOf(Kind k) @safe pure nothrowReturns: the storage width in bits of an integer or float kind.Kind signedOfWidth(ushort bits) @safe pure nothrowReturns: the signed integer kind of `bits` bits (8, 16, 32 or 64).DataType supertypeOf(DataType a, DataType b) @safe pureThe common dtype both operands of an arithmetic operation are cast to before the kernel runs (D12, ADR-2026-10-18-05; one dispatch on one kind, fourteen instantiations per operation, not 196).Templates 5
The physical storage type of a kind (D5, ADR-2026-10-18-03): the D type of the same width for the integer and float kinds, long for DATETIME and TIME. BOOLEAN and STRING have no scalar physical type — their storage is packed bits and offsets-plus-bytes, handled by BooleanArray and StringArray — so the alias is void for them and kernels over physical types are constrained to the numeric and temporal kinds.
See Also
LogicalOf, NumericKindsThe logical element type of a kind (D5, ADR-2026-10-18-03): Timestamp for DATETIME, TimeOfDay for TIME, and the physical (scalar) type for everything else (bool for BOOLEAN, string for STRING). The logical layer owns display, legality and the typed conversion in get!T.
See Also
PhysicalOfThe Kind whose logical element type is T.
Parameters
T | one of the fourteen supported element types |
Returns
Kind manifest constant.true when T is one of the supported element types.
true when a value of T may appear as the scalar side of a Series operation. The same set as isSupportedElement; individual operations narrow it further (arithmetic rejects STRING and the temporal kinds, comparisons require the same kind).