mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-10-06 10:57:51 +00:00
Restrict max-memory to Extract() calls only
This commit is contained in:
parent
4fb22e495c
commit
6d06f5550b
2 changed files with 25 additions and 1 deletions
|
|
@ -257,7 +257,7 @@ func (e *executor) Execute(ctx context.Context, index string, q *pql.Query, shar
|
|||
opt = &execOptions{}
|
||||
}
|
||||
// Default maximum memory, if not passed in.
|
||||
if opt.MaxMemory == 0 {
|
||||
if opt.MaxMemory == 0 && q.HasCall("Extract") {
|
||||
opt.MaxMemory = e.maxMemory
|
||||
}
|
||||
|
||||
|
|
|
|||
24
pql/ast.go
24
pql/ast.go
|
|
@ -35,6 +35,16 @@ func (q *Query) ExpandVars(vars map[string]interface{}) (*Query, error) {
|
|||
return &other, nil
|
||||
}
|
||||
|
||||
// HasCall returns true if q contains the given call name.
|
||||
func (q *Query) HasCall(name string) bool {
|
||||
for _, c := range q.Calls {
|
||||
if c.HasCall(name) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (q *Query) startCall(name string) {
|
||||
// Coerce every name into a canonical form if we know of one.
|
||||
if canon, ok := canonicalCaps[strings.ToLower(name)]; ok {
|
||||
|
|
@ -349,6 +359,20 @@ type Call struct {
|
|||
Precomputed map[uint64]interface{}
|
||||
}
|
||||
|
||||
// HasCall returns true if q contains the given call name.
|
||||
func (c *Call) HasCall(name string) bool {
|
||||
if c.Name == name {
|
||||
return true
|
||||
}
|
||||
|
||||
for _, child := range c.Children {
|
||||
if child.HasCall(name) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// callInfo defines the arguments allowed for a particular PQL call, and
|
||||
// possibly things about its semantics. If allowUnknown is true, unfamiliar
|
||||
// non-reserved names are allowed on the assumption that they're field names.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue