Documentation
¶
Overview ¶
Package server provides a production-grade DuckDB-backed Arrow Flight SQL server.
Index ¶
- Variables
- type BatchGuard
- type Config
- type Engine
- type Server
- func (s *Server) AsFlightServer() flight.FlightServer
- func (s *Server) Close() error
- func (s *Server) ClosePreparedStatement(_ context.Context, req fsql.ActionClosePreparedStatementRequest) error
- func (s *Server) CreatePreparedStatement(ctx context.Context, req fsql.ActionCreatePreparedStatementRequest) (fsql.ActionCreatePreparedStatementResult, error)
- func (s *Server) DoExchange(ctx context.Context, stream flight.FlightService_DoExchangeServer) error
- func (s *Server) DoGetPreparedStatement(ctx context.Context, cmd fsql.PreparedStatementQuery) (*arrow.Schema, <-chan flight.StreamChunk, error)
- func (s *Server) DoGetStatement(ctx context.Context, ticket fsql.StatementQueryTicket) (*arrow.Schema, <-chan flight.StreamChunk, error)
- func (s *Server) DoPutCommandStatementUpdate(ctx context.Context, cmd fsql.StatementUpdate) (int64, error)
- func (s *Server) DoPutPreparedStatementQuery(_ context.Context, cmd fsql.PreparedStatementQuery, ...) ([]byte, error)
- func (s *Server) GetFlightInfoPreparedStatement(ctx context.Context, cmd fsql.PreparedStatementQuery, ...) (*flight.FlightInfo, error)
- func (s *Server) GetFlightInfoStatement(ctx context.Context, cmd fsql.StatementQuery, desc *flight.FlightDescriptor) (*flight.FlightInfo, error)
- func (s *Server) GetSchemaPreparedStatement(ctx context.Context, cmd fsql.PreparedStatementQuery, ...) (*flight.SchemaResult, error)
- func (s *Server) GetSchemaStatement(ctx context.Context, cmd fsql.StatementQuery, _ *flight.FlightDescriptor) (*flight.SchemaResult, error)
- func (s *Server) Shutdown(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrEmptyQuery = status.Error(codes.InvalidArgument, "empty query provided") ErrNotFound = status.Error(codes.NotFound, "statement handle not found or expired") ErrInternal = status.Error(codes.Internal, "internal server error") ErrCancelled = status.Error(codes.Canceled, "execution cancelled by client") ErrInvalidSQL = status.Error(codes.InvalidArgument, "invalid SQL statement") )
Functions ¶
This section is empty.
Types ¶
type BatchGuard ¶ added in v0.15.0
type BatchGuard struct {
// contains filtered or unexported fields
}
BatchGuard provides deterministic ownership of an Arrow RecordBatch. It ensures that a batch is released exactly once, preventing double-frees and memory leaks on early returns, evictions, or overwrites.
func NewBatchGuard ¶ added in v0.15.0
func NewBatchGuard(b arrow.RecordBatch) *BatchGuard
func (*BatchGuard) Release ¶ added in v0.15.0
func (g *BatchGuard) Release()
Release drops the reference safely. It is idempotent.
func (*BatchGuard) Retain ¶ added in v0.15.0
func (g *BatchGuard) Retain() arrow.RecordBatch
Retain returns the underlying batch and increments its reference count. The caller is now responsible for releasing the returned batch.
type Engine ¶ added in v0.18.0
type Engine interface {
BuildStream(ctx context.Context, sql string, params arrow.RecordBatch) (*arrow.Schema, <-chan flight.StreamChunk, error)
AcquireQuerySlot(ctx context.Context) error
ReleaseQuerySlot()
DeriveSchema(ctx context.Context, sql string) (*arrow.Schema, error)
ExecuteUpdate(ctx context.Context, sql string) (int64, error)
Allocator() memory.Allocator
Close() error
}
type Server ¶
type Server struct {
fsql.BaseServer
Engine Engine
Alloc memory.Allocator
Logger *slog.Logger
// contains filtered or unexported fields
}
func (*Server) AsFlightServer ¶
func (s *Server) AsFlightServer() flight.FlightServer
func (*Server) ClosePreparedStatement ¶
func (*Server) CreatePreparedStatement ¶
func (s *Server) CreatePreparedStatement( ctx context.Context, req fsql.ActionCreatePreparedStatementRequest, ) (fsql.ActionCreatePreparedStatementResult, error)
func (*Server) DoExchange ¶
func (s *Server) DoExchange( ctx context.Context, stream flight.FlightService_DoExchangeServer, ) error
DoExchange operates outside the BaseServer routing and allows us to bypass channels entirely for true, zero-copy, synchronous streaming.
func (*Server) DoGetPreparedStatement ¶
func (s *Server) DoGetPreparedStatement( ctx context.Context, cmd fsql.PreparedStatementQuery, ) (*arrow.Schema, <-chan flight.StreamChunk, error)
func (*Server) DoGetStatement ¶
func (s *Server) DoGetStatement( ctx context.Context, ticket fsql.StatementQueryTicket, ) (*arrow.Schema, <-chan flight.StreamChunk, error)
func (*Server) DoPutCommandStatementUpdate ¶
func (*Server) DoPutPreparedStatementQuery ¶
func (s *Server) DoPutPreparedStatementQuery( _ context.Context, cmd fsql.PreparedStatementQuery, reader flight.MessageReader, _ flight.MetadataWriter, ) ([]byte, error)
func (*Server) GetFlightInfoPreparedStatement ¶
func (s *Server) GetFlightInfoPreparedStatement( ctx context.Context, cmd fsql.PreparedStatementQuery, desc *flight.FlightDescriptor, ) (*flight.FlightInfo, error)
func (*Server) GetFlightInfoStatement ¶
func (s *Server) GetFlightInfoStatement( ctx context.Context, cmd fsql.StatementQuery, desc *flight.FlightDescriptor, ) (*flight.FlightInfo, error)
func (*Server) GetSchemaPreparedStatement ¶
func (s *Server) GetSchemaPreparedStatement( ctx context.Context, cmd fsql.PreparedStatementQuery, _ *flight.FlightDescriptor, ) (*flight.SchemaResult, error)
func (*Server) GetSchemaStatement ¶
func (s *Server) GetSchemaStatement( ctx context.Context, cmd fsql.StatementQuery, _ *flight.FlightDescriptor, ) (*flight.SchemaResult, error)
Click to show internal directories.
Click to hide internal directories.