Documentation ¶
Index ¶
- Constants
- Variables
- func InitAddress(addr string)
- func New(db string, sql string, uid string, e engine.Engine, proc *process.Process) *compile
- func Print(prefix []byte, ss []*Scope)
- func Transfer(s *Scope) protocol.Scope
- func Untransfer(s *Scope, ps protocol.Scope)
- func UntransferIns(ins, pins vm.Instructions)
- type Col
- type Exec
- type Scope
- func (s *Scope) CreateDatabase(ts uint64) error
- func (s *Scope) CreateIndex(ts uint64) error
- func (s *Scope) CreateTable(ts uint64) error
- func (s *Scope) Delete(ts uint64, e engine.Engine) (uint64, error)
- func (s *Scope) DropDatabase(ts uint64) error
- func (s *Scope) DropIndex(ts uint64) error
- func (s *Scope) DropTable(ts uint64) error
- func (s *Scope) Insert(ts uint64) (uint64, error)
- func (s *Scope) MergeRun(e engine.Engine) error
- func (s *Scope) ParallelRun(e engine.Engine) error
- func (s *Scope) RemoteRun(e engine.Engine) error
- func (s *Scope) Run(e engine.Engine) (err error)
- func (s *Scope) RunAQ(e engine.Engine) error
- func (s *Scope) RunCAQ(e engine.Engine, op *times.Argument) error
- func (s *Scope) RunCAQWithSubquery(e engine.Engine, op *times.Argument) error
- func (s *Scope) RunCQ(e engine.Engine, op *join.Argument) error
- func (s *Scope) RunCQWithSubquery(e engine.Engine, op *join.Argument) error
- func (s *Scope) RunQ(e engine.Engine) error
- func (s *Scope) ShowColumns(u interface{}, fill func(interface{}, *batch.Batch) error) error
- func (s *Scope) ShowCreateDatabase(u interface{}, fill func(interface{}, *batch.Batch) error) error
- func (s *Scope) ShowCreateTable(u interface{}, fill func(interface{}, *batch.Batch) error) error
- func (s *Scope) ShowDatabases(u interface{}, fill func(interface{}, *batch.Batch) error) error
- func (s *Scope) ShowTables(u interface{}, fill func(interface{}, *batch.Batch) error) error
- func (s *Scope) Update(ts uint64, e engine.Engine) (uint64, error)
- type Source
Constants ¶
const ( Merge = iota Normal Remote Parallel Insert CreateDatabase CreateTable CreateIndex DropDatabase DropTable DropIndex ShowDatabases ShowTables ShowColumns ShowCreateTable ShowCreateDatabase Delete Update )
type of scope
const ( BQ = iota // bare query AQ // aggregation query CQ // conjunctive query CAQ // conjunctive aggregation query )
type of query
const (
UnitLimit = 256
)
size limit on the number of tuples to be processed at a time
Variables ¶
var Address string
Address is the ip:port of local node
var OneInt64s []int64
OneInt64s is a slice whose size is equal to UnitLimit and whose value is all 1
Functions ¶
func Untransfer ¶
Untransfer is used to transfer a protocol.Scope to Scope
func UntransferIns ¶
func UntransferIns(ins, pins vm.Instructions)
UntransferIns is used to transfer Instructions
Types ¶
type Exec ¶
type Exec struct {
// contains filtered or unexported fields
}
Exec stores all information related to the execution phase of a single sql.
func (*Exec) Compile ¶
Compile is the entrance of the compute-layer, it compiles AST tree to scope list. A scope is an execution unit.
func (*Exec) GetAffectedRows ¶
type Scope ¶
type Scope struct { // Magic specifies the type of Scope. // 0 - execution unit for reading data. // 1 - execution unit for processing intermediate results. // 2 - execution unit that requires remote call. Magic int Plan plan.Plan // DataSource stores information about data source. DataSource *Source // PreScopes contains children of this scope will inherit and execute. PreScopes []*Scope // NodeInfo contains the information about the remote node. NodeInfo engine.Node // Instructions contains command list of this scope. Instructions vm.Instructions // Proc contains the execution context. Proc *process.Process }
Scope is the output of the compile process. Each sql will be compiled to one or more execution unit scopes.
func (*Scope) CreateDatabase ¶
CreateDatabase do create database work according to create database plan.
func (*Scope) CreateIndex ¶
CreateIndex do create index work according to create index plan
func (*Scope) CreateTable ¶
CreateTable do create table work according to create table plan.
func (*Scope) DropDatabase ¶
DropDatabase do drop database work according to drop index plan
func (*Scope) MergeRun ¶
MergeRun range and run the scope's pre-scopes by go-routine, and finally run itself to do merge work.
func (*Scope) ParallelRun ¶
ParallelRun try to execute the scope in parallel way.
func (*Scope) RemoteRun ¶
RemoteRun send the scope to a remote node (if target node is itself, it is same to function ParallelRun) and run it.
func (*Scope) RunAQ ¶
RunAQ run the scope which sql is a query for single table with aggregate functions
func (*Scope) RunCAQWithSubquery ¶
RunCAQWithSubquery run the scope which sql is a query for conjunctive aggregation query
func (*Scope) RunCQWithSubquery ¶
RunCQWithSubquery run the scope which sql is a query for conjunctive query and fact table is subquery
func (*Scope) RunQ ¶
RunQ run the scope which sql is a query for single table and without any aggregate functions it will build a multi-layer merging structure according to the scope, and finally run it. For an example, if the input scope is
[transform -> order -> push]
and we assume that there are 4 Cores at the node, we will convert it to be
s1: [transform -> order -> push] - - > m1 s2: [transform -> order -> push] - - > m1 s3: [transform -> order -> push] - - > m2 s4: [transform -> order -> push] - - > m2 m1 : [mergeOrder -> push] - - > m3 m2 : [mergeOrder -> push] - - > m3 m3 : [mergeOrder -> push] - - > top scope
func (*Scope) ShowColumns ¶
ShowColumns fill batch with column information of a table
func (*Scope) ShowCreateDatabase ¶
ShowCreateDatabase fill batch with definition of a database
func (*Scope) ShowCreateTable ¶
ShowCreateTable fill batch with definition of a table
func (*Scope) ShowDatabases ¶
ShowDatabases fill batch with all database names
func (*Scope) ShowTables ¶
ShowTables fill batch with all table names in a database