func (ctx *ExecutionContext) Send(result *Result) error {
	select {
	case <-ctx.InterruptCh:
		return ErrQueryInterrupted
	case <-ctx.AbortCh:
		return ErrQueryAborted
	case ctx.Results <- result:
	}
	return nil
}
Send sends a Result to the Results channel and will exit if the query has
been interrupted or aborted.
package query
import (
	"context"
	"errors"
	"fmt"
	"os"
	"runtime/debug"
	"strconv"
	"sync"
	"sync/atomic"
	"time"
	"github.com/influxdata/influxdb/models"
	"github.com/influxdata/influxql"
	"go.uber.org/zap"
)
var (
	ErrInvalidQuery = errors.New("invalid query")
	ErrNotExecuted = errors.New("not executed")
	ErrQueryInterrupted = errors.New("query interrupted")
	ErrQueryAborted = errors.New("query aborted")
	ErrQueryEngineShutdown = errors.New("query engine shutdown")
	ErrQueryTimeoutLimitExceeded = errors.New("query-timeout limit exceeded")
	ErrAlreadyKilled = errors.New("already killed")
)
const (
	statQueriesActive          = "queriesActive"    
	statQueriesExecuted        = "queriesExecuted"  
	statQueriesFinished        = "queriesFinished"  
	statQueryExecutionDuration = "queryDurationNs"  
	statRecoveredPanics        = "recoveredPanics"  
	PanicCrashEnv = "INFLUXDB_PANIC_CRASH"
)
func ErrDatabaseNotFound(name string) error { return fmt.Errorf("database not found: %s", name) }
func ErrMaxSelectPointsLimitExceeded(n, limit int) error {
	return fmt.Errorf("max-select-point limit exceeed: (%d/%d)", n, limit)
}
func ErrMaxConcurrentQueriesLimitExceeded(n, limit int) error {
	return fmt.Errorf("max-concurrent-queries limit exceeded(%d, %d)", n, limit)
}
type Authorizer interface {
	AuthorizeDatabase(p influxql.Privilege, name string) bool
	AuthorizeQuery(database string, query *influxql.Query) error
	AuthorizeSeriesRead(database string, measurement []byte, tags models.Tags) bool
	AuthorizeSeriesWrite(database string, measurement []byte, tags models.Tags) bool
}
type openAuthorizer struct{}
var OpenAuthorizer = openAuthorizer{}
func (a openAuthorizer) AuthorizeDatabase(influxql.Privilege, string) bool { return true }
func (a openAuthorizer) AuthorizeSeriesRead(database string, measurement []byte, tags models.Tags) bool {
	return true
}
func (a openAuthorizer) AuthorizeSeriesWrite(database string, measurement []byte, tags models.Tags) bool {
	return true
}
func (a openAuthorizer) AuthorizeQuery(_ string, _ *influxql.Query) error { return nil }
func AuthorizerIsOpen(a Authorizer) bool {
	return a == nil || a == OpenAuthorizer
}
type ExecutionOptions struct {
	Database string
	Authorizer Authorizer
	ChunkSize int
	ReadOnly bool
	NodeID uint64
	Quiet bool
	AbortCh <-chan struct{}
}
type ExecutionContext struct {
	StatementID int
	QueryID uint64
	Query *QueryTask
	Results chan *Result
	InterruptCh <-chan struct{}
	ExecutionOptions
}
func (ctx *ExecutionContext) send(result *Result) error {
	select {
	case <-ctx.AbortCh:
		return ErrQueryAborted
	case ctx.Results <- result:
	}
	return nil
}