Ejemplo n.º 1
0
func (this *builder) VisitUnionAll(node *algebra.UnionAll) (interface{}, error) {
	this.order = nil             // Disable aggregates from ORDER BY
	this.delayProjection = false // Disable ORDER BY non-projected expressions
	this.limit = nil

	first, err := node.First().Accept(this)
	if err != nil {
		return nil, err
	}

	second, err := node.Second().Accept(this)
	if err != nil {
		return nil, err
	}

	this.maxParallelism = 0
	return plan.NewUnionAll(first.(plan.Operator), second.(plan.Operator)), nil
}
Ejemplo n.º 2
0
func (this *builder) VisitUnion(node *algebra.Union) (interface{}, error) {
	// Inject DISTINCT into both terms
	distinct := this.distinct
	this.distinct = true
	defer func() { this.distinct = distinct }()

	this.order = nil             // Disable aggregates from ORDER BY
	this.delayProjection = false // Disable ORDER BY non-projected expressions
	this.limit = nil

	first, err := node.First().Accept(this)
	if err != nil {
		return nil, err
	}

	second, err := node.Second().Accept(this)
	if err != nil {
		return nil, err
	}

	this.maxParallelism = 0
	unionAll := plan.NewUnionAll(first.(plan.Operator), second.(plan.Operator))
	return plan.NewSequence(unionAll, plan.NewDistinct()), nil
}