Documentation
¶
Overview ¶
Package datafusion provides a database/sql driver backed by Apache DataFusion.
The driver registers as "datafusion". It is intended for in-process analytic SQL over DataFusion's memory/session catalog and Arrow execution engine. Standard database/sql row scanning is supported for scalar Arrow types, and QueryArrowContext exposes native Arrow record batches for callers that need exact Arrow schemas or complex values. RegisterArrowReader registers Go Arrow record readers as DataFusion in-memory tables.
Index ¶
- Constants
- Variables
- func ExecStatements(ctx context.Context, execer SQLExecerContext, statements []string) error
- func LimitReader(reader array.RecordReader, limit int64) (array.RecordReader, error)
- func ProjectReader(reader array.RecordReader, indices []int) (array.RecordReader, error)
- func RegisterArrowReader(ctx context.Context, sqlConn *sql.Conn, tableName string, ...) error
- func RegisterArrowReaderZeroCopy(ctx context.Context, sqlConn *sql.Conn, tableName string, ...) error
- func RegisterCatalog(ctx context.Context, conn *sql.Conn, name string, catalog CatalogProvider) error
- func RegisterScalarFunction(ctx context.Context, conn *sql.Conn, f ScalarFunction) error
- type And
- type ArrowReader
- type Between
- type CatalogProvider
- type Column
- type Compare
- type CompareOp
- type Conn
- func (conn *Conn) Begin() (driver.Tx, error)
- func (conn *Conn) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error)
- func (conn *Conn) CheckNamedValue(nv *driver.NamedValue) error
- func (conn *Conn) Close() error
- func (conn *Conn) ExecContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Result, error)
- func (conn *Conn) IsValid() bool
- func (conn *Conn) Ping(ctx context.Context) error
- func (conn *Conn) Prepare(query string) (driver.Stmt, error)
- func (conn *Conn) PrepareContext(ctx context.Context, query string) (driver.Stmt, error)
- func (conn *Conn) QueryArrowContext(ctx context.Context, query string, args []driver.NamedValue) (ArrowReader, error)
- func (conn *Conn) QueryContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Rows, error)
- func (conn *Conn) ResetSession(ctx context.Context) error
- type Connector
- type ConnectorOption
- type Date
- type Decimal
- type DiscoverableCatalogProvider
- type Driver
- type Duration
- type Error
- type ErrorType
- type Expr
- type InList
- type InsertOp
- type IsNull
- type Literal
- type LiteralType
- type NativeErrorKind
- type Not
- type Null
- type Or
- type ParameterType
- type PushdownTableProvider
- type RegisteredTable
- type SQLExecerContext
- type ScalarFunction
- type ScanOptions
- type Session
- func (s *Session) Close() error
- func (s *Session) DeregisterTable(ctx context.Context, name string) error
- func (s *Session) ExecContext(ctx context.Context, query string, args ...any) (driver.Result, error)
- func (s *Session) QueryArrowContext(ctx context.Context, query string, args ...any) (ArrowReader, error)
- func (s *Session) RegisterArrowReader(ctx context.Context, name string, reader array.RecordReader) error
- func (s *Session) RegisterCatalog(ctx context.Context, name string, catalog CatalogProvider) error
- func (s *Session) RegisterScalarFunction(ctx context.Context, f ScalarFunction) error
- func (s *Session) RegisterTableProvider(ctx context.Context, name string, p TableProvider) error
- type Stmt
- func (s *Stmt) CheckNamedValue(nv *driver.NamedValue) error
- func (s *Stmt) Close() error
- func (s *Stmt) Exec(args []driver.Value) (driver.Result, error)
- func (s *Stmt) ExecContext(ctx context.Context, args []driver.NamedValue) (driver.Result, error)
- func (s *Stmt) NumInput() int
- func (s *Stmt) Query(args []driver.Value) (driver.Rows, error)
- func (s *Stmt) QueryContext(ctx context.Context, args []driver.NamedValue) (driver.Rows, error)
- type TableProvider
- type Time
- type TimeUnit
- type Timestamp
- type UInt64
- type Volatility
- type WritableTableProvider
Constants ¶
const ( Volatile = native.Volatile Stable = native.Stable Immutable = native.Immutable )
const ( InsertAppend = native.InsertAppend InsertOverwrite = native.InsertOverwrite InsertReplace = native.InsertReplace )
const ( // DataFusionVersion is the exact Rust datafusion crate version pinned by this release. DataFusionVersion = "55.1.0" // DataFusionVersionEncoded is used in Go module tags: v<major>.<encoded-datafusion-version>.<patch>. DataFusionVersionEncoded = "550100" // DataFusionGoMajor is the major component of datafusion-go release tags. DataFusionGoMajor = 0 // DataFusionGoPatch is the patch component of datafusion-go release tags. DataFusionGoPatch = 1 // DataFusionGoVersion is the full datafusion-go module version without the leading v. DataFusionGoVersion = "0.550100.1" )
const CompareEq = native.CompareEq
const CompareGt = native.CompareGt
const CompareGtEq = native.CompareGtEq
const CompareLt = native.CompareLt
const CompareLtEq = native.CompareLtEq
const CompareNeq = native.CompareNeq
const LiteralBinary = native.LiteralBinary
const LiteralBool = native.LiteralBool
const LiteralDate32 = native.LiteralDate32
const LiteralDate64 = native.LiteralDate64
const LiteralFloat32 = native.LiteralFloat32
const LiteralFloat64 = native.LiteralFloat64
const LiteralInt16 = native.LiteralInt16
const LiteralInt32 = native.LiteralInt32
const LiteralInt64 = native.LiteralInt64
const LiteralInt8 = native.LiteralInt8
const LiteralTimestamp = native.LiteralTimestamp
const LiteralUint16 = native.LiteralUint16
const LiteralUint32 = native.LiteralUint32
const LiteralUint64 = native.LiteralUint64
const LiteralUint8 = native.LiteralUint8
const LiteralUtf8 = native.LiteralUtf8
const TimeUnitMicrosecond = native.TimeUnitMicrosecond
const TimeUnitMillisecond = native.TimeUnitMillisecond
const TimeUnitNanosecond = native.TimeUnitNanosecond
const TimeUnitSecond = native.TimeUnitSecond
Variables ¶
var ( // ErrNativeCancelled matches errors caused by native query cancellation. ErrNativeCancelled = native.ErrCancelled // ErrNativeInvalidArgument matches native invalid-argument errors. ErrNativeInvalidArgument = native.ErrInvalidArgument // ErrNativeFailure matches uncategorized native DataFusion failures. ErrNativeFailure = native.ErrFailure // ErrNativePanic matches panics caught on the Rust side of the FFI boundary. ErrNativePanic = native.ErrPanic )
Functions ¶
func ExecStatements ¶
func ExecStatements(ctx context.Context, execer SQLExecerContext, statements []string) error
ExecStatements executes already-split SQL statements in order.
DataFusion prepares exactly one SQL statement at a time, so callers handling migration files should split the script before calling this helper.
func LimitReader ¶ added in v0.550100.1
func LimitReader(reader array.RecordReader, limit int64) (array.RecordReader, error)
LimitReader returns at most limit rows, slicing the last batch without copying buffers. A limit of -1 is unbounded; zero does not read the input. Other negative values are invalid. This helper is suitable for ScanOptions.Limit after any source-side filtering; it does not evaluate ScanOptions.Filters. Ownership and concurrency follow ProjectReader. Release always releases the owned input, including when the limit is reached before input EOF.
func ProjectReader ¶ added in v0.550100.1
func ProjectReader(reader array.RecordReader, indices []int) (array.RecordReader, error)
ProjectReader returns a reader selecting columns in the requested order, without copying their buffers. Nil selects all columns; an empty non-nil slice selects zero columns while preserving row counts. Duplicates are allowed. Schema, field and batch metadata are preserved. The indices are copied.
On success ownership of reader transfers to the result. On error ownership stays with the caller. Retain/Release are concurrency-safe; other reader methods must not run concurrently. Retain a batch to keep it after Next or Release.
func RegisterArrowReader ¶
func RegisterArrowReader(ctx context.Context, sqlConn *sql.Conn, tableName string, reader array.RecordReader) error
RegisterArrowReader registers the remaining batches in reader as a DataFusion in-memory table visible to SQL executed on sqlConn.
This safe path serializes the reader to an Arrow IPC stream and lets the native side decode that stream into Rust-owned Arrow batches. That copy is intentional: the registered table can outlive this call, while ordinary Go Arrow arrays may use Go-owned buffers that must not be retained by native code after a cgo call returns.
func RegisterArrowReaderZeroCopy ¶
func RegisterArrowReaderZeroCopy(ctx context.Context, sqlConn *sql.Conn, tableName string, reader array.RecordReader) error
RegisterArrowReaderZeroCopy registers the remaining batches in reader as a DataFusion in-memory table by exporting reader through the Arrow C Stream Interface.
Unlike RegisterArrowReader, this path does not copy buffers into Rust-owned memory. Use it only when every exported Arrow buffer is safe for native code to retain until the registered table is dropped or the owning DataFusion session/connector is closed, for example buffers allocated with Arrow Go's mallocator or another C/foreign allocator. Passing ordinary Go-allocated Arrow buffers can violate cgo pointer lifetime rules because DataFusion keeps table batches after this call returns.
func RegisterCatalog ¶ added in v0.550100.0
func RegisterCatalog(ctx context.Context, conn *sql.Conn, name string, catalog CatalogProvider) error
RegisterCatalog adds a lazily resolved catalog. Existing names cannot be replaced.
func RegisterScalarFunction ¶ added in v0.550100.0
RegisterScalarFunction registers a batch-oriented Go function. The signature is exact (including nested field metadata). Arguments are borrowed; the returned array transfers ownership to the engine. Callbacks must honor ctx cancellation. Built-in and already registered names cannot be replaced by this function.
Types ¶
type ArrowReader ¶
ArrowReader streams Arrow record batches returned by DataFusion.
Callers must close the reader when they are done with it. Close cancels any in-flight native execution and releases native Arrow stream resources.
func QueryArrowContext ¶
func QueryArrowContext(ctx context.Context, sqlConn *sql.Conn, query string, args ...any) (ArrowReader, error)
QueryArrowContext runs query on a DataFusion *sql.Conn and returns Arrow record batches without converting them through database/sql values.
type Between ¶ added in v0.550100.0
Between describes a typed predicate supplied to a pushdown provider.
type CatalogProvider ¶ added in v0.550100.0
type CatalogProvider = native.CatalogProvider
CatalogProvider resolves remote tables once per query for planning. It does not require enumeration or guarantee transactions across a changing catalog. Return nil, nil for missing tables; honor the supplied context for remote I/O.
type Column ¶ added in v0.550100.0
Column describes a typed predicate supplied to a pushdown provider.
type Compare ¶ added in v0.550100.0
Compare describes a typed predicate supplied to a pushdown provider.
type CompareOp ¶ added in v0.550100.0
CompareOp describes a typed predicate supplied to a pushdown provider.
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn is a single database/sql driver connection to a DataFusion SessionContext.
func (*Conn) Begin ¶
Begin returns an unsupported error because DataFusion transactions are not supported.
func (*Conn) BeginTx ¶
BeginTx returns an unsupported error after honoring an already-canceled context.
func (*Conn) CheckNamedValue ¶
func (conn *Conn) CheckNamedValue(nv *driver.NamedValue) error
CheckNamedValue normalizes DataFusion-specific parameter wrapper types.
func (*Conn) ExecContext ¶
func (conn *Conn) ExecContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Result, error)
ExecContext executes a statement and returns a database/sql result.
func (*Conn) PrepareContext ¶
PrepareContext validates and prepares query.
func (*Conn) QueryArrowContext ¶
func (conn *Conn) QueryArrowContext(ctx context.Context, query string, args []driver.NamedValue) (ArrowReader, error)
QueryArrowContext executes a query and returns Arrow record batches.
type Connector ¶
type Connector struct {
// contains filtered or unexported fields
}
Connector owns the native DataFusion database handle used to open pooled connections.
func NewConnector ¶
NewConnector creates a DataFusion connector for database/sql.
func NewConnectorWithInitContext ¶
func NewConnectorWithInitContext(dsn string, initFn func(context.Context, driver.ExecerContext) error, options ...ConnectorOption) (*Connector, error)
NewConnectorWithInitContext creates a DataFusion connector with an optional initialization callback and connector options.
type ConnectorOption ¶
type ConnectorOption func(*connectorOptions)
ConnectorOption configures a DataFusion connector.
func WithPreparedStatementCache ¶ added in v0.550100.0
func WithPreparedStatementCache(enabled bool) ConnectorOption
WithPreparedStatementCache opts into caching parsed SQL syntax. Tables, plans, parameter values and parser-setting changes are resolved on every execution. An explicit option overrides the corresponding DSN parameter.
func WithRuntimeWorkers ¶ added in v0.550100.0
func WithRuntimeWorkers(workers int) ConnectorOption
WithRuntimeWorkers limits native Tokio worker threads for this connector. Zero preserves the runtime default; negative values are rejected at creation. An explicit option overrides the corresponding DSN parameter.
func WithSharedRuntime ¶ added in v0.550100.0
func WithSharedRuntime(shared bool) ConnectorOption
WithSharedRuntime opts into sharing Tokio workers with connectors that request the same worker count. Catalogs and DataFusion memory pools remain independent. An explicit option overrides the corresponding DSN parameter.
func WithSharedSession ¶
func WithSharedSession(shared bool) ConnectorOption
WithSharedSession controls whether connections from one Connector share a DataFusion SessionContext.
type Date ¶
type Date struct {
// contains filtered or unexported fields
}
Date binds a parameter as an Arrow Date32 value.
func DateFromTime ¶
DateFromTime returns a Date using t's calendar date in t's location.
type Decimal ¶
type Decimal struct {
// contains filtered or unexported fields
}
Decimal binds a parameter as an Arrow Decimal128 value.
func DecimalString ¶
DecimalString returns a Decimal parameter from a base-10 string, precision, and scale.
func NewDecimalString ¶
NewDecimalString validates and returns a Decimal parameter from a base-10 string, precision, and scale.
type DiscoverableCatalogProvider ¶ added in v0.550100.1
type DiscoverableCatalogProvider = native.DiscoverableCatalogProvider
DiscoverableCatalogProvider adds optional schema/table enumeration for SHOW TABLES and information_schema queries. Listings form a per-query snapshot; tables resolve lazily when column metadata or data is needed. Implementations must provide any stronger consistency across a changing remote catalog.
type Duration ¶
type Duration struct {
// contains filtered or unexported fields
}
Duration binds a parameter as an Arrow duration with nanosecond precision.
func DurationFromTime ¶
DurationFromTime returns a Duration from a Go time.Duration.
func DurationNanos ¶
DurationNanos returns a Duration from nanoseconds.
func (Duration) Nanoseconds ¶
Nanoseconds returns the duration as nanoseconds.
type Error ¶
type Error struct {
// Type identifies the driver operation that failed.
Type ErrorType
// NativeKind identifies native DataFusion failures when available.
NativeKind NativeErrorKind
// Message is the driver-level error message.
Message string
// Cause is the wrapped native or lower-level error.
Cause error
}
Error is the structured error type returned by this driver.
type ErrorType ¶
type ErrorType string
ErrorType identifies the operation that failed.
const ( // ErrorConnect marks failures while opening a database or connection. ErrorConnect ErrorType = "connect" // ErrorPrepare marks failures while parsing or preparing SQL. ErrorPrepare ErrorType = "prepare" // ErrorBind marks failures while binding SQL parameters. ErrorBind ErrorType = "bind" // ErrorExecute marks failures while executing SQL or reading result batches. ErrorExecute ErrorType = "execute" // ErrorScan marks failures while adapting Arrow values to database/sql rows. ErrorScan ErrorType = "scan" // ErrorClosed marks use of a closed connector, connection, statement, or reader. ErrorClosed ErrorType = "closed" // ErrorUnsupported marks operations DataFusion does not support through this driver. ErrorUnsupported ErrorType = "unsupported" // ErrorNative marks uncategorized native FFI failures. ErrorNative ErrorType = "native" )
type InList ¶ added in v0.550100.0
InList describes a typed predicate supplied to a pushdown provider.
type IsNull ¶ added in v0.550100.0
IsNull describes a typed predicate supplied to a pushdown provider.
type Literal ¶ added in v0.550100.0
Literal describes a typed predicate supplied to a pushdown provider.
type LiteralType ¶ added in v0.550100.0
type LiteralType = native.LiteralType
LiteralType describes a typed predicate supplied to a pushdown provider.
type NativeErrorKind ¶
type NativeErrorKind string
NativeErrorKind is the stable public classification for native DataFusion errors.
const ( // NativeErrorKindCancelled indicates a query canceled through context cancellation. NativeErrorKindCancelled NativeErrorKind = "cancelled" // NativeErrorKindInvalidArgument indicates invalid SQL, parameters, or API input. NativeErrorKindInvalidArgument NativeErrorKind = "invalid_argument" // NativeErrorKindNative indicates an uncategorized native DataFusion failure. NativeErrorKindNative NativeErrorKind = "native" // NativeErrorKindPanic indicates a panic caught on the Rust side of the FFI boundary. NativeErrorKindPanic NativeErrorKind = "panic" )
type Null ¶
type Null struct {
// contains filtered or unexported fields
}
Null binds a typed null parameter.
func NullDecimal ¶
NullDecimal returns a typed decimal null.
func NullOf ¶
func NullOf(typ ParameterType) Null
NullOf returns a typed null for non-decimal parameter types.
func NullTimestamp ¶
NullTimestamp returns a typed timestamp null with an explicit Arrow time zone string.
func (Null) TimeZone ¶
TimeZone returns the Arrow timestamp timezone string for timestamp typed nulls.
func (Null) Type ¶
func (value Null) Type() ParameterType
Type returns the typed-null parameter type.
type ParameterType ¶
type ParameterType int
ParameterType names a DataFusion scalar type for typed null parameters.
const ( // ParameterBool identifies a boolean parameter. ParameterBool ParameterType = iota + 1 // ParameterInt64 identifies a signed 64-bit integer parameter. ParameterInt64 // ParameterUInt64 identifies an unsigned 64-bit integer parameter. ParameterUInt64 // ParameterFloat64 identifies a 64-bit floating point parameter. ParameterFloat64 // ParameterString identifies a UTF-8 string parameter. ParameterString // ParameterBinary identifies a binary parameter. ParameterBinary // ParameterDate identifies an Arrow Date32 parameter. ParameterDate // ParameterTime identifies an Arrow Time64 nanosecond parameter. ParameterTime // ParameterTimestamp identifies an Arrow timestamp parameter. ParameterTimestamp // ParameterDuration identifies an Arrow duration nanosecond parameter. ParameterDuration // ParameterDecimal identifies an Arrow Decimal128 parameter. ParameterDecimal )
type PushdownTableProvider ¶ added in v0.550100.0
type PushdownTableProvider = native.PushdownTableProvider
PushdownTableProvider can avoid source I/O using exact projection and advisory filters.
type RegisteredTable ¶ added in v0.530100.2
type RegisteredTable struct {
// contains filtered or unexported fields
}
RegisteredTable is a handle to a table registered on a connection by RegisterFFITableProvider. The handle is safe for concurrent use.
The table's lifetime follows the session it was registered on, not this handle. Closing sqlConn returns its physical connection to the pool, and does not guarantee table release in either session mode. An isolated session is discarded when that connection is reset or physically closed; a shared session can outlive every individual sqlConn. Deregister explicitly while sqlConn is open when deterministic catalog removal is needed.
Catalog removal does not invalidate already-created query plans, views, readers, or Arrow batches. Before unloading the producing library, callers must stop new queries, remove every registration and dependent view, close all dependent readers, and release their batches. The library must remain loaded until all foreign objects (including the original provider) are freed.
Dropping the handle never deregisters the table: a caller may legitimately keep querying it after dropping the handle. Deregistration is therefore always explicit.
func RegisterFFITableProvider ¶ added in v0.530100.2
func RegisterFFITableProvider(ctx context.Context, sqlConn *sql.Conn, tableName string, provider unsafe.Pointer, providerDataFusionVersion string) (*RegisteredTable, error)
RegisterFFITableProvider registers a foreign datafusion-ffi FFI_TableProvider, produced by another library, as a queryable table named tableName on the DataFusion connection backing sqlConn. Once registered, SQL executed on sqlConn can scan the table, and projection/filter predicates are pushed down into the foreign provider.
The table is registered on sqlConn's session, following the usual session semantics: with WithSharedSession it is registered on the shared session and is therefore visible to every connection sharing it, not just sqlConn.
provider must point to a valid, initialized datafusion-ffi FFI_TableProvider that is owned by the producing foreign library — memory allocated by that library (C/Rust), not Go heap memory. Registration clones callback pointers out of the provider and native code invokes them long after this call returns, so passing a Go-allocated pointer would violate cgo's pointer-passing rules and risk corruption once Go's garbage collector moves or frees it. providerDataFusionVersion is the datafusion version the library that produced provider was built against; obtain it from that library (not from DataFusionVersion). Registration fails with an error if it does not equal this package's DataFusionVersion — the two sides must link the same datafusion version for the provider's memory layout to be compatible. This check happens before provider is dereferenced, so a version mismatch is a clean error rather than a crash; it is cooperative and cannot detect a mislabeled provider.
Lifetime: registration clones the provider (bumping its internal refcount), so the caller still owns the original FFI_TableProvider pointer and may free it through its producing library once this call returns. The producing library itself must stay loaded until every registration and dependent foreign object is released, including query plans, views, readers, and returned Arrow batches (see RegisteredTable). Deregister or closing sqlConn alone does not establish that lifetime. Unloading earlier leaves foreign callbacks dangling. The DataFusion session backing the provider should also outlive all dependent queries; if it does not, queries fail with an error.
func RegisterTableProvider ¶ added in v0.550100.0
func RegisterTableProvider(ctx context.Context, conn *sql.Conn, name string, p TableProvider) (*RegisteredTable, error)
RegisterTableProvider registers a lazy Go source on a SQL connection's session. Registration retains the provider; each scan receives query cancellation. Ordinary Go Arrow allocations are supported: batches are copied into native-safe buffers before native code retains them. Duplicate names return an error.
func (*RegisteredTable) Deregister ¶ added in v0.530100.2
func (t *RegisteredTable) Deregister(ctx context.Context) error
Deregister removes the table from the session it was registered on. Under WithSharedSession that is the shared session, so the table is removed for every connection sharing it, not just sqlConn. Calling it more than once is a no-op that returns nil, and deregistering a name that is no longer registered is not an error.
Deregister removes the catalog entry in either session mode. Existing views, query plans, readers, and batches can retain foreign objects afterward, so the producing library must still outlive them. Deregister runs on sqlConn, which must remain open; a closed connection returns sql.ErrConnDone.
func (*RegisteredTable) Name ¶ added in v0.530100.2
func (t *RegisteredTable) Name() string
Name returns the table name this handle refers to.
type SQLExecerContext ¶
type SQLExecerContext interface {
ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
}
SQLExecerContext is implemented by *sql.DB, *sql.Conn, and *sql.Tx.
type ScalarFunction ¶ added in v0.550100.0
type ScalarFunction = native.ScalarFunction
ScalarFunction defines a typed, context-aware, vectorized Go UDF.
type ScanOptions ¶ added in v0.550100.0
type ScanOptions = native.ScanOptions
ScanOptions specifies projection, conservative predicates and a safe limit hint.
type Session ¶ added in v0.550100.0
type Session struct {
// contains filtered or unexported fields
}
Session is an Arrow-oriented DataFusion session without database/sql pooling. Queries use the same execution, cancellation and ownership implementation as the SQL driver. A Session is safe for concurrent use. Close releases its own references; active readers and returned batches retain their native owners.
func NewSession ¶ added in v0.550100.0
func NewSession(dsn string, options ...ConnectorOption) (*Session, error)
NewSession creates a directly usable session. Existing connector options and DSN configuration work unchanged. Close the session when it is no longer used.
func (*Session) Close ¶ added in v0.550100.0
Close is idempotent. It releases registrations after their remaining users finish.
func (*Session) DeregisterTable ¶ added in v0.550100.0
DeregisterTable removes a catalog entry. Existing readers and batches stay valid.
func (*Session) ExecContext ¶ added in v0.550100.0
func (s *Session) ExecContext(ctx context.Context, query string, args ...any) (driver.Result, error)
ExecContext executes SQL and consumes the result, including any write work.
func (*Session) QueryArrowContext ¶ added in v0.550100.0
func (s *Session) QueryArrowContext(ctx context.Context, query string, args ...any) (ArrowReader, error)
QueryArrowContext executes SQL and transfers ownership of the batch reader.
func (*Session) RegisterArrowReader ¶ added in v0.550100.0
func (s *Session) RegisterArrowReader(ctx context.Context, name string, reader array.RecordReader) error
RegisterArrowReader copies the remaining batches into an atomic in-memory registration using bounded IPC staging. The caller retains the input reader.
func (*Session) RegisterCatalog ¶ added in v0.550100.0
RegisterCatalog adds a lazy catalog to this session.
func (*Session) RegisterScalarFunction ¶ added in v0.550100.0
func (s *Session) RegisterScalarFunction(ctx context.Context, f ScalarFunction) error
RegisterScalarFunction registers a batch-oriented function in this session.
func (*Session) RegisterTableProvider ¶ added in v0.550100.0
RegisterTableProvider registers a lazy Go source in this session.
type Stmt ¶
type Stmt struct {
// contains filtered or unexported fields
}
Stmt is a prepared DataFusion statement.
func (*Stmt) CheckNamedValue ¶
func (s *Stmt) CheckNamedValue(nv *driver.NamedValue) error
CheckNamedValue normalizes DataFusion-specific parameter wrapper types.
func (*Stmt) ExecContext ¶
ExecContext executes the statement with normalized named values.
func (*Stmt) NumInput ¶
NumInput returns the number of SQL parameters found while preparing the statement.
func (*Stmt) QueryContext ¶
QueryContext executes the statement with normalized named values.
type TableProvider ¶ added in v0.550100.0
type TableProvider = native.TableProvider
TableProvider supplies a fresh, owned Arrow reader per scan. Implementations must be concurrency-safe and honor cancellation. The engine owns each returned reader and releases it after use. Go buffers are copied before native retention.
type Time ¶
type Time struct {
// contains filtered or unexported fields
}
Time binds a parameter as an Arrow Time64 nanosecond value.
func NewTimeNanos ¶
NewTimeNanos validates and returns a Time from nanoseconds since midnight.
func TimeFromTime ¶
TimeFromTime returns a Time using only t's clock fields in t's location.
func (Time) Nanoseconds ¶
Nanoseconds returns the nanoseconds since midnight.
type TimeUnit ¶ added in v0.550100.0
TimeUnit describes a typed predicate supplied to a pushdown provider.
type Timestamp ¶
type Timestamp struct {
// contains filtered or unexported fields
}
Timestamp binds a parameter as an Arrow timestamp with nanosecond precision.
func TimestampFromTime ¶
TimestampFromTime returns a UTC timestamp parameter for t.
func TimestampWithTimeZone ¶
TimestampWithTimeZone returns a timestamp parameter with an explicit Arrow time zone string.
type Volatility ¶ added in v0.550100.0
type Volatility = native.Volatility
Volatility declares a function's optimizer semantics; zero is Volatile.
type WritableTableProvider ¶ added in v0.550100.0
type WritableTableProvider = native.WritableTableProvider
WritableTableProvider optionally accepts INSERT with a bounded input stream.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
arrow
command
|
|
|
extensions
command
|
|
|
parameters
command
|
|
|
simple
command
|
|
|
internal
|
|
|
conformance
Package conformance describes the query fixtures shared by the Go, Rust, and SQLite test runners.
|
Package conformance describes the query fixtures shared by the Go, Rust, and SQLite test runners. |
|
native
Adapted from cedricziel/datafusion-golang (Apache-2.0), commit 54272e7.
|
Adapted from cedricziel/datafusion-golang (Apache-2.0), commit 54272e7. |
|
tools/genabi
command
Command genabi derives loader declarations and contract tests from the C ABI.
|
Command genabi derives loader declarations and contract tests from the C ABI. |
|
tools/genversions
command
|
|
|
Package providertest checks the reader and ownership contracts of Go table providers.
|
Package providertest checks the reader and ownership contracts of Go table providers. |