Ejemplo n.º 1
0
//  and limitations under the License.

package execution

import (
	"github.com/couchbase/query/util"
	"github.com/couchbase/query/value"
)

func notifyChildren(children ...Operator) {
	for _, child := range children {
		if child != nil {
			select {
			case child.StopChannel() <- false:
			default:
			}
		}
	}
}

func copyOperator(op Operator) Operator {
	if op == nil {
		return nil
	} else {
		return op.Copy()
	}
}

var _STRING_POOL = util.NewStringPool(_BATCH_SIZE)
var _STRING_ANNOTATED_POOL = value.NewStringAnnotatedPool(_BATCH_SIZE)
Ejemplo n.º 2
0
)

func eval(cx expression.Expressions, context *Context, parent value.Value) (value.Values, bool) {
	if cx == nil {
		return nil, true
	}

	cv := make(value.Values, len(cx))
	var e error
	for i, expr := range cx {
		cv[i], e = expr.Evaluate(parent, context)
		if e != nil {
			context.Error(errors.NewEvaluationError(e, "filter term"))
			return nil, false
		}
	}

	return cv, true
}

func notifyConn(stopchannel datastore.StopChannel) {
	select {
	case stopchannel <- false:
	default:
	}
}

var _SCAN_POOL = NewOperatorPool(16)
var _COUNT_POOL = util.NewStringIntPool(1024)
var _VALUE_POOL = value.NewStringAnnotatedPool(1024)