Make remote joins use parallel http requests

This commit is contained in:
Vikram Rangnekar
2019-06-02 01:38:51 -04:00
parent f9fc5dd7de
commit 8b06473e58
10 changed files with 143 additions and 106 deletions

View File

@ -48,14 +48,14 @@ func (o *Operation) Reset() {
}
type Field struct {
ID uint16
ID int16
Name string
Alias string
Args []Arg
argsA [10]Arg
ParentID uint16
Children []uint16
childrenA [10]uint16
ParentID int16
Children []int16
childrenA [10]int16
}
type Arg struct {
@ -277,7 +277,7 @@ func (p *Parser) parseFields(fields []Field) ([]Field, error) {
return nil, errors.New("expecting an alias or field name")
}
fields = append(fields, Field{ID: uint16(len(fields))})
fields = append(fields, Field{ID: int16(len(fields))})
f := &fields[(len(fields) - 1)]
f.Args = f.argsA[:0]
f.Children = f.childrenA[:0]
@ -288,7 +288,7 @@ func (p *Parser) parseFields(fields []Field) ([]Field, error) {
if f.ID != 0 {
intf := st.Peek()
pid, ok := intf.(uint16)
pid, ok := intf.(int16)
if !ok {
return nil, fmt.Errorf("14: unexpected value %v (%t)", intf, intf)

View File

@ -29,8 +29,8 @@ type Column struct {
}
type Select struct {
ID uint16
ParentID uint16
ID int16
ParentID int16
RelID uint64
Args map[string]*Node
AsList bool
@ -42,7 +42,7 @@ type Select struct {
OrderBy []*OrderBy
DistinctOn []string
Paging Paging
Children []uint16
Children []int16
}
type Exp struct {
@ -197,7 +197,8 @@ func (com *Compiler) CompileQuery(query string) (*QCode, error) {
}
func (com *Compiler) compileQuery(op *Operation) (*Query, error) {
var id, parentID uint16
id := int16(0)
parentID := int16(-1)
selects := make([]Select, 0, 5)
st := util.NewStack()
@ -218,7 +219,7 @@ func (com *Compiler) compileQuery(op *Operation) (*Query, error) {
}
intf := st.Pop()
fid, ok := intf.(uint16)
fid, ok := intf.(int16)
if !ok {
return nil, fmt.Errorf("15: unexpected value %v (%t)", intf, intf)
@ -235,7 +236,7 @@ func (com *Compiler) compileQuery(op *Operation) (*Query, error) {
ID: id,
ParentID: parentID,
Table: tn,
Children: make([]uint16, 0, 5),
Children: make([]int16, 0, 5),
}
if s.ID != 0 {