Documentation
¶
Index ¶
- Constants
- Variables
- func ContainDim(des []string, src string) bool
- func DecodeQuerySchema(pb *internal.QuerySchema) (hybridqp.Catalog, error)
- func EncodeQuerySchema(schema hybridqp.Catalog) *internal.QuerySchema
- func ErrDatabaseNotFound(name string) error
- func ErrMaxConcurrentQueriesLimitExceeded(n, limit int) error
- func ErrMaxSelectPointsLimitExceeded(n, limit int) error
- func RegistryStmtBuilderCreator(creator StmtBuilderCreator) bool
- func RewriteStatement(stmt influxql.Statement) (influxql.Statement, error)
- func StrCallType(name string, args []influxql.DataType) (influxql.DataType, error)
- func StrLenCallType(name string, args []influxql.DataType) (influxql.DataType, error)
- func SubStrCallType(name string, args []influxql.DataType) (influxql.DataType, error)
- type CallTypeMapper
- func (CallTypeMapper) CallType(name string, args []influxql.DataType) (influxql.DataType, error)
- func (CallTypeMapper) MapType(measurement *influxql.Measurement, field string) influxql.DataType
- func (CallTypeMapper) MapTypeBatch(measurement *influxql.Measurement, field map[string]influxql.DataType, ...) error
- type CoarseAuthorizer
- type CompileOptions
- type ExecutionContext
- type ExecutionOptions
- type Executor
- type FieldMapper
- type FineAuthorizer
- type FunctionTypeMapper
- func (m FunctionTypeMapper) CallType(name string, args []influxql.DataType) (influxql.DataType, error)
- func (FunctionTypeMapper) MapType(measurement *influxql.Measurement, field string) influxql.DataType
- func (FunctionTypeMapper) MapTypeBatch(measurement *influxql.Measurement, field map[string]influxql.DataType, ...) error
- type LogicalPlanCreator
- type MathTypeMapper
- func (MathTypeMapper) CallType(name string, args []influxql.DataType) (influxql.DataType, error)
- func (MathTypeMapper) MapType(measurement *influxql.Measurement, field string) influxql.DataType
- func (MathTypeMapper) MapTypeBatch(measurement *influxql.Measurement, field map[string]influxql.DataType, ...) error
- type MathValuer
- type Monitor
- type MonitorFunc
- type PreparedStatement
- type ProcessorOptions
- func (opt ProcessorOptions) ChunkSizeNum() int
- func (opt *ProcessorOptions) Clone() *ProcessorOptions
- func (opt ProcessorOptions) CloseRowChan()
- func (opt ProcessorOptions) DerivativeInterval() hybridqp.Interval
- func (opt ProcessorOptions) ElapsedInterval() hybridqp.Interval
- func (opt *ProcessorOptions) GetCondition() influxql.Expr
- func (opt ProcessorOptions) GetDimensions() []string
- func (opt ProcessorOptions) GetEndTime() int64
- func (opt *ProcessorOptions) GetGroupBy() map[string]struct{}
- func (opt *ProcessorOptions) GetHintType() hybridqp.HintType
- func (opt *ProcessorOptions) GetLimit() int
- func (opt ProcessorOptions) GetMaxParallel() int
- func (opt *ProcessorOptions) GetOffset() int
- func (opt ProcessorOptions) GetOptDimension() []string
- func (opt ProcessorOptions) GetStartTime() int64
- func (opt *ProcessorOptions) HasInterval() bool
- func (opt *ProcessorOptions) ISChunked() bool
- func (opt ProcessorOptions) IntegralInterval() hybridqp.Interval
- func (opt ProcessorOptions) IsAscending() bool
- func (opt *ProcessorOptions) IsGroupByAllDims() bool
- func (opt *ProcessorOptions) MarshalBinary() ([]byte, error)
- func (opt ProcessorOptions) MergeSorted() bool
- func (opt ProcessorOptions) OptionsName() string
- func (opt ProcessorOptions) SeekTime() int64
- func (opt *ProcessorOptions) SetAscending(a bool)
- func (opt *ProcessorOptions) SetHintType(h hybridqp.HintType)
- func (opt ProcessorOptions) StopTime() int64
- func (opt *ProcessorOptions) UnmarshalBinary(buf []byte) error
- func (opt *ProcessorOptions) UpdateSources(sources influxql.Sources)
- func (opt ProcessorOptions) Window(t int64) (start, end int64)
- func (opt *ProcessorOptions) Zone(ns int64) (string, int64)
- type QueryInfo
- type RowsChan
- type SelectOptions
- type ShardGroup
- type ShardMapper
- type Statement
- type StatementExecutor
- type StatementNormalizer
- type StmtBuilder
- type StmtBuilderCreator
- type StmtBuilderCreatorFactory
- type StringFunctionTypeMapper
- func (m StringFunctionTypeMapper) CallType(name string, _ []influxql.DataType) (influxql.DataType, error)
- func (m StringFunctionTypeMapper) MapType(_ *influxql.Measurement, _ string) influxql.DataType
- func (m StringFunctionTypeMapper) MapTypeBatch(_ *influxql.Measurement, _ map[string]influxql.DataType, _ *influxql.Schema) error
- type Task
- type TaskManager
- func (t *TaskManager) AttachQuery(q *influxql.Query, opt ExecutionOptions, interrupt <-chan struct{}, ...) (*ExecutionContext, func(), error)
- func (t *TaskManager) Close() error
- func (t *TaskManager) DetachQuery(qid uint64) error
- func (t *TaskManager) ExecuteStatement(stmt influxql.Statement, ctx *ExecutionContext) error
- func (t *TaskManager) KillQuery(qid uint64) error
- func (t *TaskManager) Queries() []QueryInfo
- func (t *TaskManager) Statistics(buffer []byte) ([]byte, error)
- type TaskStatus
Constants ¶
const ( // PanicCrashEnv is the environment variable that, when set, will prevent // the handler from recovering any panics. PanicCrashEnv = "INFLUXDB_PANIC_CRASH" QueryDurationKey = "QueryDuration" )
Statistics for the Executor
const ( // DefaultQueryTimeout is the default timeout for executing a query. // A value of zero will have no query timeout. DefaultQueryTimeout = time.Duration(0) )
Variables ¶
var ( // ErrInvalidQuery is returned when executing an unknown query type. ErrInvalidQuery = errors.New("invalid query") // ErrNotExecuted is returned when a statement is not executed in a query. // This can occur when a previous statement in the same query has errored. ErrNotExecuted = errors.New("not executed") // ErrQueryInterrupted is an error returned when the query is interrupted. ErrQueryInterrupted = errors.New("query interrupted") // ErrQueryAborted is an error returned when the query is aborted. ErrQueryAborted = errors.New("query aborted") // ErrQueryEngineShutdown is an error sent when the query cannot be // created because the query engine was shutdown. ErrQueryEngineShutdown = errors.New("query engine shutdown") // ErrQueryTimeoutLimitExceeded is an error when a query hits the max time allowed to run. ErrQueryTimeoutLimitExceeded = errors.New("query-timeout limit exceeded") // ErrAlreadyKilled is returned when attempting to kill a query that has already been killed. ErrAlreadyKilled = errors.New("already killed") )
var OpenAuthorizer = openAuthorizer{}
OpenAuthorizer can be shared by all goroutines.
var OpenCoarseAuthorizer openCoarseAuthorizer
OpenCoarseAuthorizer is a fully permissive implementation of CoarseAuthorizer.
Functions ¶
func ContainDim ¶
func DecodeQuerySchema ¶
func DecodeQuerySchema(pb *internal.QuerySchema) (hybridqp.Catalog, error)
func EncodeQuerySchema ¶
func EncodeQuerySchema(schema hybridqp.Catalog) *internal.QuerySchema
func ErrDatabaseNotFound ¶
ErrDatabaseNotFound returns a database not found error for the given database name.
func ErrMaxConcurrentQueriesLimitExceeded ¶
ErrMaxConcurrentQueriesLimitExceeded is an error when a query cannot be run because the maximum number of queries has been reached.
func ErrMaxSelectPointsLimitExceeded ¶
ErrMaxSelectPointsLimitExceeded is an error when a query hits the maximum number of points.
func RegistryStmtBuilderCreator ¶
func RegistryStmtBuilderCreator(creator StmtBuilderCreator) bool
func RewriteStatement ¶
RewriteStatement rewrites stmt into a new statement, if applicable.
func StrCallType ¶
func StrLenCallType ¶
Types ¶
type CallTypeMapper ¶
type CallTypeMapper struct{}
CallTypeMapper returns the types for call iterator functions. Call iterator functions are commonly implemented within the storage engine so this mapper is limited to only the return values of those functions.
func (CallTypeMapper) MapType ¶
func (CallTypeMapper) MapType(measurement *influxql.Measurement, field string) influxql.DataType
func (CallTypeMapper) MapTypeBatch ¶
func (CallTypeMapper) MapTypeBatch(measurement *influxql.Measurement, field map[string]influxql.DataType, schema *influxql.Schema) error
type CoarseAuthorizer ¶
type CoarseAuthorizer interface {
// AuthorizeDatabase indicates whether the given Privilege is authorized on the database with the given name.
AuthorizeDatabase(p originql.Privilege, name string) bool
}
CoarseAuthorizer determines if certain operations are authorized at the database level.
It is supported both in OSS and Enterprise.
type CompileOptions ¶
CompileOptions are the customization options for the compiler.
type ExecutionContext ¶
type ExecutionContext struct {
context.Context
// The query ID of the executing query.
QueryID uint64
// Output channel where results and errors should be sent.
Results chan *query.Result
// Options used to start this query.
ExecutionOptions
// contains filtered or unexported fields
}
ExecutionContext contains state that the query is currently executing with.
func (*ExecutionContext) Done ¶
func (ctx *ExecutionContext) Done() <-chan struct{}
func (*ExecutionContext) Err ¶
func (ctx *ExecutionContext) Err() error
func (*ExecutionContext) Send ¶
func (ctx *ExecutionContext) Send(result *query.Result) error
Send sends a Result to the Results channel and will exit if the query has been interrupted or aborted.
func (*ExecutionContext) Value ¶
func (ctx *ExecutionContext) Value(key interface{}) interface{}
type ExecutionOptions ¶
type ExecutionOptions struct {
// The database the query is running against.
Database string
// The retention policy the query is running against.
RetentionPolicy string
// Authorizer handles series-level authorization
Authorizer FineAuthorizer
// CoarseAuthorizer handles database-level authorization
CoarseAuthorizer CoarseAuthorizer
// Node to execute on.
NodeID uint64
// The requested maximum number of points to return in each result.
ChunkSize int
// If this query return chunk once by once
Chunked bool
// If this query is being executed in a read-only context.
ReadOnly bool
QueryLimitEn bool
// Quiet suppresses non-essential output from the query executor.
Quiet bool
// AbortCh is a channel that signals when results are no longer desired by the caller.
AbortCh <-chan struct{}
// The ChunkImpl maximum number of points to contain. Developers are advised to change only.
InnerChunkSize int
Traceid uint64
// The results of the query executor
RowsChan chan RowsChan
}
ExecutionOptions contains the options for executing a query.
type Executor ¶
type Executor struct {
// Used for executing a statement in the query.
StatementExecutor StatementExecutor
// Used for tracking running queries.
TaskManager *TaskManager
// Logger to use for all logging.
// Defaults to discarding all log output.
Logger *zap.Logger
}
Executor executes every statement in an Query.
func (*Executor) Close ¶
Close kills all running queries and prevents new queries from being attached.
func (*Executor) ExecuteQuery ¶
func (e *Executor) ExecuteQuery(query *influxql.Query, opt ExecutionOptions, closing chan struct{}, qDuration *statistics.SQLSlowQueryStatistics) <-chan *query2.Result
ExecuteQuery executes each statement within a query.
func (*Executor) WithLogger ¶
SetLogOutput sets the writer to which all logs are written. It must not be called after Open is called.
type FieldMapper ¶
type FieldMapper struct {
influxql.FieldMapper
}
FieldMapper is a FieldMapper that wraps another FieldMapper and exposes the functions implemented by the query engine.
type FineAuthorizer ¶
type FineAuthorizer interface {
// AuthorizeDatabase indicates whether the given Privilege is authorized on the database with the given name.
AuthorizeDatabase(p originql.Privilege, name string) bool
// AuthorizeSeriesRead determines if a series is authorized for reading
AuthorizeSeriesRead(database string, measurement []byte, tags models.Tags) bool
// AuthorizeSeriesWrite determines if a series is authorized for writing
AuthorizeSeriesWrite(database string, measurement []byte, tags models.Tags) bool
}
FineAuthorizer determines if certain operations are authorized at the series level.
It is only supported in InfluxDB Enterprise. In OSS it always returns true.
type FunctionTypeMapper ¶
type FunctionTypeMapper struct {
CallTypeMapper
}
FunctionTypeMapper handles the type mapping for all functions implemented by the query engine.
func (FunctionTypeMapper) MapType ¶
func (FunctionTypeMapper) MapType(measurement *influxql.Measurement, field string) influxql.DataType
func (FunctionTypeMapper) MapTypeBatch ¶
func (FunctionTypeMapper) MapTypeBatch(measurement *influxql.Measurement, field map[string]influxql.DataType, schema *influxql.Schema) error
type LogicalPlanCreator ¶
type LogicalPlanCreator interface {
// Creates a simple iterator for use in an InfluxQL Logical.
CreateLogicalPlan(ctx context.Context, sources influxql.Sources, schema hybridqp.Catalog) (hybridqp.QueryNode, error)
// Determines the potential cost for creating an iterator.
LogicalPlanCost(source *influxql.Measurement, opt ProcessorOptions) (hybridqp.LogicalPlanCost, error)
GetSources(sources influxql.Sources) influxql.Sources
}
type MathTypeMapper ¶
type MathTypeMapper struct{}
func (MathTypeMapper) MapType ¶
func (MathTypeMapper) MapType(measurement *influxql.Measurement, field string) influxql.DataType
func (MathTypeMapper) MapTypeBatch ¶
func (MathTypeMapper) MapTypeBatch(measurement *influxql.Measurement, field map[string]influxql.DataType, schema *influxql.Schema) error
type MathValuer ¶
type MathValuer struct{}
func (MathValuer) Call ¶
func (v MathValuer) Call(name string, args []interface{}) (interface{}, bool)
func (MathValuer) Value ¶
func (MathValuer) Value(key string) (interface{}, bool)
type Monitor ¶
type Monitor interface {
// Monitor starts a new goroutine that will monitor a query. The function
// will be passed in a channel to signal when the query has been finished
// normally. If the function returns with an error and the query is still
// running, the query will be terminated.
Monitor(fn MonitorFunc)
}
Monitor monitors the status of a query and returns whether the query should be aborted with an error.
func MonitorFromContext ¶
MonitorFromContext returns a Monitor embedded within the Context if one exists.
type MonitorFunc ¶
type MonitorFunc func(<-chan struct{}) error
MonitorFunc is a function that will be called to check if a query is currently healthy. If the query needs to be interrupted for some reason, the error should be returned by this function.
type PreparedStatement ¶
type PreparedStatement interface {
Select(ctx context.Context) (hybridqp.Executor, error)
ChangeCreator(hybridqp.ExecutorBuilderCreator)
ChangeOptimizer(hybridqp.ExecutorBuilderOptimizer)
// Explain outputs the explain plan for this statement.
Explain() (string, error)
// Close closes the resources associated with this prepared statement.
// This must be called as the mapped shards may hold open resources such
// as network connections.
Close() error
}
PreparedStatement is a prepared statement that is ready to be executed.
func NewPreparedStatement ¶
func NewPreparedStatement(stmt *influxql.SelectStatement, opt hybridqp.Options, shards interface { LogicalPlanCreator io.Closer }, columns []string, MaxPointN int, now time.Time) PreparedStatement
func Prepare ¶
func Prepare(stmt *influxql.SelectStatement, shardMapper ShardMapper, opt SelectOptions) (PreparedStatement, error)
Prepare will compile the statement with the default compile options and then prepare the query.
type ProcessorOptions ¶
type ProcessorOptions struct {
Name string
Expr influxql.Expr
// Expression to iterate for.
// This can be VarRef or a Call.
Exprs []influxql.Expr
// Auxiliary tags or values to also retrieve for the point.
Aux []influxql.VarRef
FieldAux []influxql.VarRef
TagAux []influxql.VarRef
// Data sources from which to receive data. This is only used for encoding
// measurements over RPC and is no longer used in the open source version.
Sources []influxql.Source
// Group by interval and tags.
Interval hybridqp.Interval
Dimensions []string // The final dimensions of the query (stays the same even in subqueries).
GroupBy map[string]struct{} // Dimensions to group points by in intermediate iterators.
Location *time.Location
// Fill options.
Fill influxql.FillOption
FillValue interface{}
// Condition to filter by.
Condition influxql.Expr
// Time range for the iterator.
StartTime int64
EndTime int64
// Limits the number of points per series.
Limit, Offset int
// Limits the number of series.
SLimit, SOffset int
// Sorted in time ascending order if true.
Ascending bool
// Removes the measurement name. Useful for meta queries.
StripName bool
// Removes duplicate rows from raw queries.
Dedupe bool
// Determines if this is a query for raw data or an aggregate/selector.
Ordered bool
Parallel bool
// Limits on the creation of iterators.
MaxSeriesN int
// If this channel is set and is closed, the iterator should try to exit
// and close as soon as possible.
InterruptCh <-chan struct{}
// Authorizer can limit access to data
Authorizer FineAuthorizer
// The requested maximum number of points to return in each result.
ChunkedSize int
// If this query return chunk once by once
Chunked bool
ChunkSize int
MaxParallel int
AbortChan <-chan struct{}
RowsChan chan RowsChan
Query string
EnableBinaryTreeMerge int64
Traceid uint64
// hint supported (need to marshal)
HintType hybridqp.HintType
// SeriesKey is assigned only the query is single time series, and it's used in the index.
SeriesKey []byte
GroupByAllDims bool
}
ProcessorOptions is an object passed to CreateIterator to specify creation options.
func NewProcessorOptionsStmt ¶
func NewProcessorOptionsStmt(stmt *influxql.SelectStatement, sopt SelectOptions) (opt ProcessorOptions, err error)
NewProcessorOptionsStmt creates the iterator options from stmt.
func (ProcessorOptions) ChunkSizeNum ¶
func (opt ProcessorOptions) ChunkSizeNum() int
func (*ProcessorOptions) Clone ¶
func (opt *ProcessorOptions) Clone() *ProcessorOptions
func (ProcessorOptions) CloseRowChan ¶
func (opt ProcessorOptions) CloseRowChan()
func (ProcessorOptions) DerivativeInterval ¶
func (opt ProcessorOptions) DerivativeInterval() hybridqp.Interval
DerivativeInterval returns the time interval for the derivative function.
func (ProcessorOptions) ElapsedInterval ¶
func (opt ProcessorOptions) ElapsedInterval() hybridqp.Interval
ElapsedInterval returns the time interval for the elapsed function.
func (*ProcessorOptions) GetCondition ¶
func (opt *ProcessorOptions) GetCondition() influxql.Expr
func (ProcessorOptions) GetDimensions ¶
func (opt ProcessorOptions) GetDimensions() []string
GetDimensions retrieves the dimensions for this query.
func (ProcessorOptions) GetEndTime ¶
func (opt ProcessorOptions) GetEndTime() int64
func (*ProcessorOptions) GetGroupBy ¶
func (opt *ProcessorOptions) GetGroupBy() map[string]struct{}
func (*ProcessorOptions) GetHintType ¶
func (opt *ProcessorOptions) GetHintType() hybridqp.HintType
func (*ProcessorOptions) GetLimit ¶
func (opt *ProcessorOptions) GetLimit() int
func (ProcessorOptions) GetMaxParallel ¶
func (opt ProcessorOptions) GetMaxParallel() int
func (*ProcessorOptions) GetOffset ¶
func (opt *ProcessorOptions) GetOffset() int
func (ProcessorOptions) GetOptDimension ¶
func (opt ProcessorOptions) GetOptDimension() []string
func (ProcessorOptions) GetStartTime ¶
func (opt ProcessorOptions) GetStartTime() int64
func (*ProcessorOptions) HasInterval ¶
func (opt *ProcessorOptions) HasInterval() bool
func (*ProcessorOptions) ISChunked ¶
func (opt *ProcessorOptions) ISChunked() bool
func (ProcessorOptions) IntegralInterval ¶
func (opt ProcessorOptions) IntegralInterval() hybridqp.Interval
IntegralInterval returns the time interval for the integral function.
func (ProcessorOptions) IsAscending ¶
func (opt ProcessorOptions) IsAscending() bool
func (*ProcessorOptions) IsGroupByAllDims ¶ added in v0.2.0
func (opt *ProcessorOptions) IsGroupByAllDims() bool
func (*ProcessorOptions) MarshalBinary ¶
func (opt *ProcessorOptions) MarshalBinary() ([]byte, error)
MarshalBinary encodes opt into a binary format.
func (ProcessorOptions) MergeSorted ¶
func (opt ProcessorOptions) MergeSorted() bool
MergeSorted returns true if the options require a sorted merge.
func (ProcessorOptions) OptionsName ¶
func (opt ProcessorOptions) OptionsName() string
func (ProcessorOptions) SeekTime ¶
func (opt ProcessorOptions) SeekTime() int64
SeekTime returns the time the iterator should start from. For ascending iterators this is the start time, for descending iterators it's the end time.
func (*ProcessorOptions) SetAscending ¶
func (opt *ProcessorOptions) SetAscending(a bool)
func (*ProcessorOptions) SetHintType ¶
func (opt *ProcessorOptions) SetHintType(h hybridqp.HintType)
func (ProcessorOptions) StopTime ¶
func (opt ProcessorOptions) StopTime() int64
StopTime returns the time the iterator should end at. For ascending iterators this is the end time, for descending iterators it's the start time.
func (*ProcessorOptions) UnmarshalBinary ¶
func (opt *ProcessorOptions) UnmarshalBinary(buf []byte) error
UnmarshalBinary decodes from a binary format in to opt.
func (*ProcessorOptions) UpdateSources ¶
func (opt *ProcessorOptions) UpdateSources(sources influxql.Sources)
func (ProcessorOptions) Window ¶
func (opt ProcessorOptions) Window(t int64) (start, end int64)
Window returns the time window [start,end) that t falls within.
type QueryInfo ¶
type QueryInfo struct {
ID uint64 `json:"id"`
Query string `json:"query"`
Database string `json:"database"`
Duration time.Duration `json:"duration"`
Status TaskStatus `json:"status"`
}
QueryInfo represents the information for a query.
type SelectOptions ¶
type SelectOptions struct {
// Authorizer is used to limit access to data
Authorizer FineAuthorizer
// Node to exclusively read from.
// If zero, all nodes are used.
NodeID uint64
// Maximum number of concurrent series.
MaxSeriesN int
// Maximum number of concurrent fileds.
MaxFieldsN int
// Maximum number of points to read from the query.
// This requires the passed in context to have a Monitor that is
// created using WithMonitor.
MaxPointN int
// Maximum number of buckets for a statement.
MaxBucketsN int
// Maximum number of memory a query can use
MaxQueryMem int64
// Maximum parallelism a query can use
MaxQueryParallel int
// The number of point for chunk
ChunkSize int
// The requested maximum number of points to return in each result.
ChunkedSize int
Chunked bool
QueryLimitEn bool
QueryTimeCompareEnabled bool
Traceid uint64
AbortChan <-chan struct{}
RowsChan chan RowsChan
HintType hybridqp.HintType
}
SelectOptions are options that customize the select call.
type ShardGroup ¶
type ShardGroup interface {
LogicalPlanCreator
influxql.FieldMapper
io.Closer
}
ShardGroup represents a shard or a collection of shards that can be accessed for creating iterators. When creating iterators, the resource used for reading the iterators should be separate from the resource used to map the shards. When the ShardGroup is closed, it should not close any resources associated with the created Iterator. Those resources belong to the Iterator and will be closed when the Iterator itself is closed. The query engine operates under this assumption and will close the shard group after creating the iterators, but before the iterators are actually read.
type ShardMapper ¶
type ShardMapper interface {
MapShards(sources influxql.Sources, t influxql.TimeRange, opt SelectOptions, condition influxql.Expr) (ShardGroup, error)
Close() error
GetSeriesKey() []byte
}
ShardMapper retrieves and maps shards into an IteratorCreator that can later be used for executing queries.
type Statement ¶
type Statement interface {
// Prepare prepares the statement by mapping shards and finishing the creation
// of the query plan.
Prepare(shardMapper ShardMapper, opt SelectOptions) (PreparedStatement, error)
}
Statement is a compiled query statement.
func Compile ¶
func Compile(stmt *influxql.SelectStatement, opt CompileOptions) (Statement, error)
type StatementExecutor ¶
type StatementExecutor interface {
// ExecuteStatement executes a statement. Results should be sent to the
// results channel in the ExecutionContext.
ExecuteStatement(stmt influxql.Statement, ctx *ExecutionContext) error
Statistics(buffer []byte) ([]byte, error)
}
StatementExecutor executes a statement within the Executor.
type StatementNormalizer ¶
type StatementNormalizer interface {
// NormalizeStatement adds a default database and policy to the
// measurements in the statement.
NormalizeStatement(stmt influxql.Statement, database, retentionPolicy string) error
}
StatementNormalizer normalizes a statement before it is executed.
type StmtBuilder ¶
type StmtBuilder interface {
}
type StmtBuilderCreator ¶
type StmtBuilderCreator interface {
Create(stmt *influxql.SelectStatement, opt hybridqp.Options,
shards interface {
LogicalPlanCreator
io.Closer
}, columns []string, MaxPointN int, now time.Time) PreparedStatement
}
type StmtBuilderCreatorFactory ¶
type StmtBuilderCreatorFactory struct {
// contains filtered or unexported fields
}
func GetStmtBuilderFactoryInstance ¶
func GetStmtBuilderFactoryInstance() *StmtBuilderCreatorFactory
func NewStmtBuilderCreatorFactory ¶
func NewStmtBuilderCreatorFactory() *StmtBuilderCreatorFactory
func (*StmtBuilderCreatorFactory) Attach ¶
func (r *StmtBuilderCreatorFactory) Attach(creator StmtBuilderCreator)
func (*StmtBuilderCreatorFactory) Create ¶
func (r *StmtBuilderCreatorFactory) Create(stmt *influxql.SelectStatement, opt hybridqp.Options, shards interface { LogicalPlanCreator io.Closer }, columns []string, MaxPointN int, now time.Time) StmtBuilder
func (*StmtBuilderCreatorFactory) Get ¶
func (r *StmtBuilderCreatorFactory) Get() StmtBuilderCreator
type StringFunctionTypeMapper ¶
type StringFunctionTypeMapper struct{}
func (StringFunctionTypeMapper) MapType ¶
func (m StringFunctionTypeMapper) MapType(_ *influxql.Measurement, _ string) influxql.DataType
func (StringFunctionTypeMapper) MapTypeBatch ¶
func (m StringFunctionTypeMapper) MapTypeBatch(_ *influxql.Measurement, _ map[string]influxql.DataType, _ *influxql.Schema) error
type Task ¶
type Task struct {
// contains filtered or unexported fields
}
Task is the internal data structure for managing queries. For the public use data structure that gets returned, see Task.
func (*Task) Error ¶
Error returns any asynchronous error that may have occurred while executing the query.
func (*Task) Monitor ¶
func (q *Task) Monitor(fn MonitorFunc)
Monitor starts a new goroutine that will monitor a query. The function will be passed in a channel to signal when the query has been finished normally. If the function returns with an error and the query is still running, the query will be terminated.
type TaskManager ¶
type TaskManager struct {
// Query execution timeout.
QueryTimeout time.Duration
// Log queries if they are slower than this time.
// If zero, slow queries will never be logged.
LogQueriesAfter time.Duration
// Maximum number of concurrent queries.
MaxConcurrentQueries int
// Logger to use for all logging.
// Defaults to discarding all log output.
Logger *zap.Logger
// contains filtered or unexported fields
}
TaskManager takes care of all aspects related to managing running queries.
func (*TaskManager) AttachQuery ¶
func (t *TaskManager) AttachQuery(q *influxql.Query, opt ExecutionOptions, interrupt <-chan struct{}, qStat *statistics.SQLSlowQueryStatistics) (*ExecutionContext, func(), error)
AttachQuery attaches a running query to be managed by the TaskManager. Returns the query id of the newly attached query or an error if it was unable to assign a query id or attach the query to the TaskManager. This function also returns a channel that will be closed when this query finishes running.
After a query finishes running, the system is free to reuse a query id.
func (*TaskManager) Close ¶
func (t *TaskManager) Close() error
Close kills all running queries and prevents new queries from being attached.
func (*TaskManager) DetachQuery ¶
func (t *TaskManager) DetachQuery(qid uint64) error
DetachQuery removes a query from the query table. If the query is not in the killed state, this will also close the related channel.
func (*TaskManager) ExecuteStatement ¶
func (t *TaskManager) ExecuteStatement(stmt influxql.Statement, ctx *ExecutionContext) error
ExecuteStatement executes a statement containing one of the task management queries.
func (*TaskManager) KillQuery ¶
func (t *TaskManager) KillQuery(qid uint64) error
KillQuery enters a query into the killed state and closes the channel from the TaskManager. This method can be used to forcefully terminate a running query.
func (*TaskManager) Queries ¶
func (t *TaskManager) Queries() []QueryInfo
Queries returns a list of all running queries with information about them.
func (*TaskManager) Statistics ¶
func (t *TaskManager) Statistics(buffer []byte) ([]byte, error)
type TaskStatus ¶
type TaskStatus int
const ( // RunningTask is set when the task is running. RunningTask TaskStatus = iota + 1 // KilledTask is set when the task is killed, but resources are still // being used. KilledTask )
func (TaskStatus) MarshalJSON ¶
func (t TaskStatus) MarshalJSON() ([]byte, error)
func (TaskStatus) String ¶
func (t TaskStatus) String() string
func (*TaskStatus) UnmarshalJSON ¶
func (t *TaskStatus) UnmarshalJSON(data []byte) error