joinAlignPlan.go 837 B

123456789101112131415161718192021222324252627282930313233343536
  1. package planner
  2. import "github.com/emqx/kuiper/xsql"
  3. type JoinAlignPlan struct {
  4. baseLogicalPlan
  5. Emitters []string
  6. }
  7. func (p JoinAlignPlan) Init() *JoinAlignPlan {
  8. p.baseLogicalPlan.self = &p
  9. return &p
  10. }
  11. // Push down to table first, then push to window
  12. func (p *JoinAlignPlan) PushDownPredicate(condition xsql.Expr) (xsql.Expr, LogicalPlan) {
  13. if len(p.children) == 0 {
  14. return condition, p.self
  15. }
  16. rest := condition
  17. for i, child := range p.children {
  18. if _, ok := child.(*DataSourcePlan); ok {
  19. var newChild LogicalPlan
  20. rest, newChild = child.PushDownPredicate(rest)
  21. p.children[i] = newChild
  22. }
  23. }
  24. for i, child := range p.children {
  25. if _, ok := child.(*DataSourcePlan); !ok {
  26. var newChild LogicalPlan
  27. rest, newChild = child.PushDownPredicate(rest)
  28. p.children[i] = newChild
  29. }
  30. }
  31. return rest, p.self
  32. }