sqlexec

package
v0.0.0-debug-20260702 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 2, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Type_I8     = "I8"
	Type_I64    = "I"
	Type_F64    = "F"
	Type_String = "S"
)

Variables

This section is empty.

Functions

func AppendFloat64

func AppendFloat64(buf []byte, value float64, bitSize int) []byte

AppendFloat64 appends a float64 value, handling infinities.

func AppendHex

func AppendHex(dst []byte, src []byte) []byte

AppendHex appends hex-encoded binary literal to buf.

func AppendInt64

func AppendInt64(buf []byte, value int64) []byte

AppendInt64 appends an int64 value as decimal text.

func AppendUint64

func AppendUint64(buf []byte, value uint64) []byte

AppendUint64 appends a uint64 value as decimal text.

func AppendVectorSQLLiteral

func AppendVectorSQLLiteral(ctx context.Context, vec *vector.Vector, row int, buf []byte) ([]byte, error)

AppendVectorSQLLiteral appends the SQL literal representation of vec[row] to buf.

func BuildExactPkFilter

func BuildExactPkFilter(ctx context.Context, vec *vector.Vector) (string, error)

BuildExactPkFilter converts a vector of primary key values into a comma-separated SQL literal string suitable for use in an IN (...) clause.

func GetTxn

func GetTxn(
	ctx context.Context,
	cnEngine engine.Engine,
	cnTxnClient client.TxnClient,
	info string,
) (client.TxnOperator, error)

func RunSql

func RunSql(sqlproc *SqlProcess, sql string) (executor.Result, error)

run SQL in batch mode. Result batches will stored in memory and return once all result batches received.

func RunStreamingSql

func RunStreamingSql(
	ctx context.Context,
	sqlproc *SqlProcess,
	sql string,
	stream_chan chan executor.Result,
	error_chan chan error,
) (executor.Result, error)

run SQL in WithStreaming() and pass the channel to SQL executor

func RunTxn

func RunTxn(sqlproc *SqlProcess, execFunc func(executor.TxnExecutor) error) error

run SQL in batch mode. Result batches will stored in memory and return once all result batches received.

func RunTxnWithSqlContext

func RunTxnWithSqlContext(ctx context.Context,
	cnEngine engine.Engine,
	cnTxnClient client.TxnClient,
	cnUUID string,
	accountId uint32,
	duration time.Duration,
	resolveVariableFunc func(varName string, isSystemVar, isGlobalVar bool) (interface{}, error),
	cbdata any,
	f func(sqlproc *SqlProcess, data any) error) (err error)

run SQL with SqlContext

func WaitUniqueJoinKeys

func WaitUniqueJoinKeys(sqlproc *SqlProcess) ([]byte, error)

WaitUniqueJoinKeys blocks until it receives a RuntimeFilter_UNIQUEJOINKEYS message that matches sqlproc.RuntimeFilterSpecs (if any). It returns the raw serialized unique join key bytes from the build side.

The caller is responsible for deserializing the bytes and deciding how to use them (e.g. exact pk IN filter vs a membership filter based on its own threshold).

Types

type ConfigValue

type ConfigValue struct {
	T string `json:"t"`
	V any    `json:"v"`
}

type Metadata

type Metadata struct {
	// contains filtered or unexported fields
}

func NewMetadata

func NewMetadata(data []byte) (*Metadata, error)

func NewMetadataFromJson

func NewMetadataFromJson(js string) (*Metadata, error)

func (*Metadata) GetString

func (m *Metadata) GetString() string

func (*Metadata) Modify

func (m *Metadata) Modify(varName string, v any) error

func (*Metadata) ResolveVariableFunc

func (m *Metadata) ResolveVariableFunc(varName string, isSystemVar, isGlobalVar bool) (any, error)

type MetadataWriter

type MetadataWriter struct {
	Cfg map[string]ConfigValue `json:"cfg"`
}

func NewMetadataWriter

func NewMetadataWriter() *MetadataWriter

func (*MetadataWriter) AddFloat

func (w *MetadataWriter) AddFloat(key string, value float64)

func (*MetadataWriter) AddInt

func (w *MetadataWriter) AddInt(key string, value int64)

func (*MetadataWriter) AddInt8

func (w *MetadataWriter) AddInt8(key string, value int8)

func (*MetadataWriter) AddString

func (w *MetadataWriter) AddString(key string, value string)

func (*MetadataWriter) Marshal

func (w *MetadataWriter) Marshal() ([]byte, error)

type SqlContext

type SqlContext struct {
	Ctx                 context.Context
	CNUuid              string
	TxnOperator         client.TxnOperator
	AccountId           uint32
	ResolveVariableFunc func(varName string, isSystemVar, isGlobalVar bool) (interface{}, error)
}

SqlContext stores required information for background SQLInternalExecutor

func NewSqlContext

func NewSqlContext(ctx context.Context,
	cnuuid string,
	txnOperator client.TxnOperator,
	accountid uint32,
	resolveVariableFunc func(varName string, isSystemVar, isGlobalVar bool) (interface{}, error),
) *SqlContext

func (*SqlContext) GetResolveVariableFunc

func (s *SqlContext) GetResolveVariableFunc() func(varName string, isSystemVar, isGlobalVar bool) (interface{}, error)

func (*SqlContext) GetService

func (s *SqlContext) GetService() string

func (*SqlContext) SetResolveVariableFunc

func (s *SqlContext) SetResolveVariableFunc(f func(varName string, isSystemVar, isGlobalVar bool) (interface{}, error))

func (*SqlContext) Txn

func (s *SqlContext) Txn() client.TxnOperator

type SqlProcess

type SqlProcess struct {
	Proc   *process.Process
	SqlCtx *SqlContext

	// Optional RuntimeFilterSpec
	RuntimeFilterSpecs []*plan.RuntimeFilterSpec
	// Optional doc_id membership-filter bytes (tagged docfilter payload) for the ivf entries scan.
	IvfMembershipFilter []byte
	// Optional doc_id membership-filter bytes (tagged docfilter payload) for the fulltext index scan.
	FulltextMembershipFilter []byte
	// Optional exact primary-key filter list (SQL literals, comma-separated).
	// When set, ivf_search uses it to build "pk IN (...)" and skip centroid filtering.
	ExactPkFilter string
	// Optional IndexReaderParam attached by vector index runtime.
	// Used to drive additional filtering in internal SQL executor (e.g. ivf entries scan).
	IndexReaderParam *plan.IndexReaderParam
}

SqlProcess is the wrapper for both process.Process and background SQLContext SqlProcess enable the API to run in both frontend and background with InternalSQLExecutor process.Process always exists in frontend. However, process.Process does not exist in background job. SqlContext with required infos such as context.Context, CNUUID, TxnOperator and AccountId enable to run SQL with InternalSQLExecutor. Either process.Process or SqlContext is used in SqlProcess. We will look for process.Process first before SqlContext

func NewSqlProcess

func NewSqlProcess(proc *process.Process) *SqlProcess

func NewSqlProcessWithContext

func NewSqlProcessWithContext(ctx *SqlContext) *SqlProcess

func (*SqlProcess) GetContext

func (s *SqlProcess) GetContext() context.Context

func (*SqlProcess) GetResolveVariableFunc

func (s *SqlProcess) GetResolveVariableFunc() func(varName string, isSystemVar, isGlobalVar bool) (interface{}, error)

func (*SqlProcess) GetTopContext

func (s *SqlProcess) GetTopContext() context.Context

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL