Move step definition validators to the end
This allows the init to correct invalid/missing bits.
This commit is contained in:
@@ -75,11 +75,6 @@ func (def *Aggregate) Optimize(reqFilter internalFilter) (rspFilter internalFilt
|
||||
}
|
||||
|
||||
func (def *Aggregate) init(ctx context.Context) (err error) {
|
||||
err = def.validate()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if def.Filter != nil {
|
||||
def.filter, err = toInternalFilter(def.Filter)
|
||||
if err != nil {
|
||||
@@ -91,6 +86,11 @@ func (def *Aggregate) init(ctx context.Context) (err error) {
|
||||
def.SourceAttributes = collectAttributes(def.rel)
|
||||
}
|
||||
|
||||
err = def.validate()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -60,11 +60,6 @@ func (def *Datasource) Optimize(req internalFilter) (res internalFilter, err err
|
||||
}
|
||||
|
||||
func (def *Datasource) init(ctx context.Context, s iterProvider) (err error) {
|
||||
err = def.validate()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if def.Filter != nil {
|
||||
def.filter, err = toInternalFilter(def.Filter)
|
||||
if err != nil {
|
||||
@@ -83,6 +78,11 @@ func (def *Datasource) init(ctx context.Context, s iterProvider) (err error) {
|
||||
|
||||
def.auxIter = iter
|
||||
|
||||
err = def.validate()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
+5
-5
@@ -84,11 +84,6 @@ func (def *Join) Optimize(req internalFilter) (res internalFilter, err error) {
|
||||
}
|
||||
|
||||
func (def *Join) init(ctx context.Context) (err error) {
|
||||
err = def.validate()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if len(def.LeftAttributes) == 0 {
|
||||
def.LeftAttributes = collectAttributes(def.relLeft)
|
||||
}
|
||||
@@ -107,6 +102,11 @@ func (def *Join) init(ctx context.Context) (err error) {
|
||||
}
|
||||
}
|
||||
|
||||
err = def.validate()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user