Пример #1
0
// Build a query execution pipeline from a query plan.
func Build(plan plan.Operator, context *Context) (Operator, error) {
	builder := &builder{context}
	x, err := plan.Accept(builder)

	if err != nil {
		return nil, err
	}

	ex := x.(Operator)
	return ex, nil
}
Пример #2
0
// Build a query execution pipeline from a query plan.
func Build(plan plan.Operator, context *Context) (Operator, error) {
	var m map[scannedIndex]bool
	if context.ScanVectorSource().Type() == timestamp.ONE_VECTOR {
		// Collect scanned indexes.
		m = make(map[scannedIndex]bool)
	}
	builder := &builder{context, m}
	x, err := plan.Accept(builder)

	if err != nil {
		return nil, err
	}

	if builder.scannedIndexes != nil && len(builder.scannedIndexes) > 1 {
		scannedIndexArr := make([]string, len(builder.scannedIndexes))
		for si := range builder.scannedIndexes {
			scannedIndexArr = append(scannedIndexArr, fmt.Sprintf("%s:%s", si.namespace, si.keyspace))
		}
		return nil, errors.NewScanVectorTooManyScannedBuckets(scannedIndexArr)
	}

	ex := x.(Operator)
	return ex, nil
}