Documentation
¶
Overview ¶
Package arrowmap provides DuckDB-free helpers for translating DuckDB type strings into Arrow types, quoting/qualifying SQL identifiers, and appending scanned values into Arrow array builders.
These helpers are kept in their own package (with no dependency on github.com/duckdb/duckdb-go) so that the control plane can use them without linking libduckdb. The DuckDB driver-specific value types (duckdb.Interval, duckdb.Decimal, duckdb.UUID, duckdb.OrderedMap, duckdb.Map) are handled via the RegisterAppender hook so duckdbservice can register them at init time without arrowmap depending on duckdb-go.
Index ¶
- func AppendValue(builder array.Builder, val any)
- func DuckDBTypeToArrow(dbType string) arrow.DataType
- func QualifyTableName(catalog, schema sql.NullString, table string) string
- func QuoteIdent(ident string) string
- func RegisterAppender(a Appender)
- func SupportsLimit(upper string) bool
- type Appender
- type DecimalValue
- type IntervalValue
- type OrderedMapValue
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendValue ¶
AppendValue appends a value to an Arrow array builder with type coercion. It first asks any registered Appender hooks (see RegisterAppender), then falls back to handling the standard Arrow / Go value types itself.
func DuckDBTypeToArrow ¶
DuckDBTypeToArrow maps a DuckDB type name to an Arrow DataType.
func QualifyTableName ¶
func QualifyTableName(catalog, schema sql.NullString, table string) string
QualifyTableName builds a qualified table name from nullable catalog/schema and table name.
func QuoteIdent ¶
QuoteIdent quotes a SQL identifier to prevent injection.
func RegisterAppender ¶
func RegisterAppender(a Appender)
RegisterAppender adds a hook that AppendValue will consult before falling back to its built-in value-type handling. Intended for use from package init() functions in importers that own driver-specific value types (e.g., duckdbservice registers handlers for duckdb.Interval, Decimal, UUID, OrderedMap, and Map).
func SupportsLimit ¶
SupportsLimit returns true if the (uppercased) query is a statement type that accepts a LIMIT clause. Statements like SHOW, DESCRIBE, EXPLAIN, PRAGMA, and CALL do not support LIMIT.
Types ¶
type Appender ¶
Appender is a hook that handles append for value types arrowmap doesn't know about (typically driver-specific types like duckdb.Interval). It reports whether it handled the value; arrowmap.AppendValue falls back to its built-in handling when no registered Appender claims the value.
Hooks must be safe to call concurrently and must not panic. They run in registration order; the first one to return true wins.
type DecimalValue ¶
DecimalValue is the duckdb-free representation of a fixed-precision decimal (the unscaled integer plus the scale). Used by the binary-format encoder in server/types.go so it can switch on this type without importing the duckdb-go driver. duckdbservice's value-normalizer hook converts duckdb.Decimal to arrowmap.DecimalValue at scan time.
func (DecimalValue) String ¶
func (d DecimalValue) String() string
String renders the decimal in plain numeric form, e.g. {314159, 5} → "3.14159" and {-5, 2} → "-0.05". Required so the PG text-protocol formatter (server.formatValue) and any other fmt.Sprint-based callers produce a number string instead of falling back to the Go default "{value scale}" struct rendering. Negative values keep the sign in front of the integer part. Scale 0 prints as the integer.
type IntervalValue ¶
IntervalValue is the duckdb-free representation of an Arrow MonthDayNanoInterval as decoded by the Flight client. It stores the component fields directly (Months/Days/Micros) so result formatters in the server package can switch on the type without importing the flight subpackage (which would create a cycle).
type OrderedMapValue ¶
OrderedMapValue represents an Arrow MAP as parallel key/value slices, preserving insertion order. Using parallel slices instead of a Go map avoids panics on non-comparable key types (e.g., []byte from BLOB keys) and preserves the source MAP ordering.
Lives in arrowmap so AppendValue can switch on it without depending on the server package, and the flight client + result formatters in server/ can both reference it without creating an import cycle.