import { BinaryReader, BinaryWriter } from "./binary"; /** DuckDB physical storage types used by vectors. */ export declare enum PhysicalType { BOOL = 1, UINT8 = 2, INT8 = 3, UINT16 = 4, INT16 = 5, UINT32 = 6, INT32 = 7, UINT64 = 8, INT64 = 9, FLOAT = 11, DOUBLE = 12, INTERVAL = 21, LIST = 23, STRUCT = 24, ARRAY = 29, VARCHAR = 200, UINT128 = 203, INT128 = 204, UNKNOWN = 205, BIT = 206, INVALID = 255 } /** DuckDB logical type ids serialized in Quack result schemas. */ export declare enum LogicalTypeId { INVALID = 0, SQLNULL = 1, UNKNOWN = 2, ANY = 3, UNBOUND = 4, TEMPLATE = 5, TYPE = 6, BOOLEAN = 10, TINYINT = 11, SMALLINT = 12, INTEGER = 13, BIGINT = 14, DATE = 15, TIME = 16, TIMESTAMP_SEC = 17, TIMESTAMP_MS = 18, TIMESTAMP = 19, TIMESTAMP_NS = 20, DECIMAL = 21, FLOAT = 22, DOUBLE = 23, CHAR = 24, VARCHAR = 25, BLOB = 26, INTERVAL = 27, UTINYINT = 28, USMALLINT = 29, UINTEGER = 30, UBIGINT = 31, TIMESTAMP_TZ = 32, TIME_TZ = 34, TIME_NS = 35, BIT = 36, STRING_LITERAL = 37, INTEGER_LITERAL = 38, BIGNUM = 39, UHUGEINT = 49, HUGEINT = 50, POINTER = 51, VALIDITY = 53, UUID = 54, GEOMETRY = 60, STRUCT = 100, LIST = 101, MAP = 102, TABLE = 103, ENUM = 104, AGGREGATE_STATE = 105, LAMBDA = 106, UNION = 107, ARRAY = 108, VARIANT = 109 } /** DuckDB ExtraTypeInfo discriminator values. */ export declare enum ExtraTypeInfoType { INVALID = 0, GENERIC = 1, DECIMAL = 2, STRING = 3, LIST = 4, STRUCT = 5, ENUM = 6, UNBOUND = 7, AGGREGATE_STATE = 8, ARRAY = 9, ANY = 10, INTEGER_LITERAL = 11, TEMPLATE = 12, GEO = 13 } /** DuckDB logical type plus optional type-specific metadata. */ export interface LogicalType { /** Logical type id. */ id: LogicalTypeId; /** Optional metadata for nested, decimal, enum, and other logical types. */ typeInfo?: ExtraTypeInfo; } /** Named child type used by STRUCT and related logical types. */ export interface ChildType { /** Child field name. */ name: string; /** Child logical type. */ type: LogicalType; } /** Coordinate reference system metadata for GEOMETRY logical types. */ export interface CoordinateReferenceSystem { /** CRS definition string as serialized by DuckDB. */ definition?: string; } interface BaseExtraTypeInfo { type: ExtraTypeInfoType; alias?: string; } /** Generic or invalid type metadata. */ export interface GenericTypeInfo extends BaseExtraTypeInfo { type: ExtraTypeInfoType.GENERIC | ExtraTypeInfoType.INVALID; } /** DECIMAL type metadata. */ export interface DecimalTypeInfo extends BaseExtraTypeInfo { type: ExtraTypeInfoType.DECIMAL; /** Decimal width. */ width: number; /** Decimal scale. */ scale: number; } /** String collation metadata. */ export interface StringTypeInfo extends BaseExtraTypeInfo { type: ExtraTypeInfoType.STRING; /** Optional DuckDB collation name. */ collation?: string; } /** LIST or MAP child-type metadata. */ export interface ListTypeInfo extends BaseExtraTypeInfo { type: ExtraTypeInfoType.LIST; /** Child logical type. */ childType: LogicalType; } /** STRUCT child metadata. */ export interface StructTypeInfo extends BaseExtraTypeInfo { type: ExtraTypeInfoType.STRUCT; /** Named child fields. */ childTypes: ChildType[]; } /** ENUM value metadata. */ export interface EnumTypeInfo extends BaseExtraTypeInfo { type: ExtraTypeInfoType.ENUM; /** Ordered enum values. */ values: string[]; } /** AGGREGATE_STATE metadata. */ export interface AggregateStateTypeInfo extends BaseExtraTypeInfo { type: ExtraTypeInfoType.AGGREGATE_STATE; /** Aggregate function name. */ functionName: string; /** Aggregate return type. */ returnType: LogicalType; /** Bound argument types. */ boundArgumentTypes: LogicalType[]; } /** ARRAY child type and fixed size metadata. */ export interface ArrayTypeInfo extends BaseExtraTypeInfo { type: ExtraTypeInfoType.ARRAY; /** Array element logical type. */ childType: LogicalType; /** Fixed number of elements per array value. */ size: number; } /** ANY type metadata. */ export interface AnyTypeInfo extends BaseExtraTypeInfo { type: ExtraTypeInfoType.ANY; /** Target type. */ targetType: LogicalType; /** DuckDB cast score. */ castScore: bigint; } /** TEMPLATE type metadata. */ export interface TemplateTypeInfo extends BaseExtraTypeInfo { type: ExtraTypeInfoType.TEMPLATE; /** Template type name. */ name: string; } /** INTEGER_LITERAL metadata marker. */ export interface IntegerLiteralTypeInfo extends BaseExtraTypeInfo { type: ExtraTypeInfoType.INTEGER_LITERAL; } /** GEOMETRY CRS metadata. */ export interface GeoTypeInfo extends BaseExtraTypeInfo { type: ExtraTypeInfoType.GEO; /** Optional coordinate reference system. */ crs?: CoordinateReferenceSystem; } /** UNBOUND type metadata. */ export interface UnboundTypeInfo extends BaseExtraTypeInfo { type: ExtraTypeInfoType.UNBOUND; /** Unbound type name. */ name?: string; /** Optional catalog name. */ catalog?: string; /** Optional schema name. */ schema?: string; } /** Union of DuckDB logical type metadata variants supported by the SDK. */ export type ExtraTypeInfo = GenericTypeInfo | DecimalTypeInfo | StringTypeInfo | ListTypeInfo | StructTypeInfo | EnumTypeInfo | AggregateStateTypeInfo | ArrayTypeInfo | AnyTypeInfo | TemplateTypeInfo | IntegerLiteralTypeInfo | GeoTypeInfo | UnboundTypeInfo; /** Create a logical type object from a DuckDB logical type id and metadata. */ export declare function logicalType(id: LogicalTypeId, typeInfo?: ExtraTypeInfo): LogicalType; /** Convenience constructors for common DuckDB logical types. */ export declare const LogicalTypes: { /** SQL NULL logical type. */ readonly null: () => LogicalType; /** BOOLEAN logical type. */ readonly boolean: () => LogicalType; /** TINYINT logical type. */ readonly tinyint: () => LogicalType; /** SMALLINT logical type. */ readonly smallint: () => LogicalType; /** INTEGER logical type. */ readonly integer: () => LogicalType; /** BIGINT logical type. */ readonly bigint: () => LogicalType; /** UTINYINT logical type. */ readonly utinyint: () => LogicalType; /** USMALLINT logical type. */ readonly usmallint: () => LogicalType; /** UINTEGER logical type. */ readonly uinteger: () => LogicalType; /** UBIGINT logical type. */ readonly ubigint: () => LogicalType; /** HUGEINT logical type. */ readonly hugeint: () => LogicalType; /** UHUGEINT logical type. */ readonly uhugeint: () => LogicalType; /** FLOAT logical type. */ readonly float: () => LogicalType; /** DOUBLE logical type. */ readonly double: () => LogicalType; /** CHAR logical type with optional collation metadata. */ readonly char: (collation?: string) => LogicalType; /** VARCHAR logical type with optional collation metadata. */ readonly varchar: (collation?: string) => LogicalType; /** BLOB logical type. */ readonly blob: () => LogicalType; /** BIT logical type. */ readonly bit: () => LogicalType; /** UUID logical type. */ readonly uuid: () => LogicalType; /** DATE logical type. */ readonly date: () => LogicalType; /** TIME logical type. */ readonly time: () => LogicalType; /** TIME_NS logical type. */ readonly timeNs: () => LogicalType; /** TIME WITH TIME ZONE logical type. */ readonly timeTz: () => LogicalType; /** TIMESTAMP logical type in microseconds. */ readonly timestamp: () => LogicalType; /** TIMESTAMP_S logical type. */ readonly timestampSeconds: () => LogicalType; /** TIMESTAMP_MS logical type. */ readonly timestampMillis: () => LogicalType; /** TIMESTAMP_NS logical type. */ readonly timestampNanos: () => LogicalType; /** TIMESTAMP WITH TIME ZONE logical type. */ readonly timestampTz: () => LogicalType; /** INTERVAL logical type. */ readonly interval: () => LogicalType; /** DECIMAL logical type with width and scale metadata. */ readonly decimal: (width: number, scale: number) => LogicalType; /** LIST logical type with a child type. */ readonly list: (childType: LogicalType) => LogicalType; /** MAP logical type with key and value child types. */ readonly map: (keyType: LogicalType, valueType: LogicalType) => LogicalType; /** STRUCT logical type with named child fields. */ readonly struct: (childTypes: ChildType[]) => LogicalType; /** ARRAY logical type with child type and fixed size. */ readonly array: (childType: LogicalType, size: number) => LogicalType; /** ENUM logical type with ordered values. */ readonly enum: (values: string[]) => LogicalType; /** GEOMETRY logical type with optional CRS metadata. */ readonly geometry: (crs?: CoordinateReferenceSystem) => LogicalType; }; /** Encode a DuckDB logical type. */ export declare function encodeLogicalType(writer: BinaryWriter, type: LogicalType): void; /** Decode a DuckDB logical type. */ export declare function decodeLogicalType(reader: BinaryReader): LogicalType; /** Encode DuckDB ExtraTypeInfo metadata. */ export declare function encodeExtraTypeInfo(writer: BinaryWriter, info: ExtraTypeInfo): void; /** Decode DuckDB ExtraTypeInfo metadata. */ export declare function decodeExtraTypeInfo(reader: BinaryReader): ExtraTypeInfo; /** Resolve the physical vector type used for a logical type. */ export declare function getPhysicalType(type: LogicalType): PhysicalType; /** Whether a physical type has fixed-size values in vector storage. */ export declare function isConstantSizePhysicalType(type: PhysicalType): boolean; /** Return the fixed byte width for a constant-size physical type. */ export declare function physicalTypeSize(type: PhysicalType): number; /** Return the child type for LIST, MAP, or ARRAY logical types. */ export declare function getChildType(type: LogicalType): LogicalType; /** Return the named child types for STRUCT-like logical types. */ export declare function getStructChildren(type: LogicalType): ChildType[]; /** Return the fixed element count for an ARRAY logical type. */ export declare function getArraySize(type: LogicalType): number; /** Return the string values for an ENUM logical type. */ export declare function getEnumValues(type: LogicalType): string[]; export {};