github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/sql/index_join.go (about)

     1  // Copyright 2015 The Cockroach Authors.
     2  //
     3  // Use of this software is governed by the Business Source License
     4  // included in the file licenses/BSL.txt.
     5  //
     6  // As of the Change Date specified in that file, in accordance with
     7  // the Business Source License, use of this software will be governed
     8  // by the Apache License, Version 2.0, included in the file
     9  // licenses/APL.txt.
    10  
    11  package sql
    12  
    13  import (
    14  	"context"
    15  
    16  	"github.com/cockroachdb/cockroach/pkg/sql/sem/tree"
    17  	"github.com/cockroachdb/cockroach/pkg/sql/sqlbase"
    18  )
    19  
    20  // indexJoinNode implements joining of results from an index with the rows
    21  // of a table. The input to an indexJoinNode is the result of scanning a
    22  // non-covering index (potentially processed through other operations like
    23  // filtering, sorting, limiting).
    24  type indexJoinNode struct {
    25  	input planNode
    26  
    27  	// Indices of the PK columns in the input plan.
    28  	keyCols []int
    29  
    30  	table *scanNode
    31  
    32  	// The columns returned by this node. While these are not ever different from
    33  	// the table scanNode in the heuristic planner, the optimizer plans them to
    34  	// be different in some cases.
    35  	cols []sqlbase.ColumnDescriptor
    36  	// There is a 1-1 correspondence between cols and resultColumns.
    37  	resultColumns sqlbase.ResultColumns
    38  
    39  	reqOrdering ReqOrdering
    40  }
    41  
    42  func (n *indexJoinNode) startExec(params runParams) error {
    43  	panic("indexJoinNode cannot be run in local mode")
    44  }
    45  
    46  func (n *indexJoinNode) Next(params runParams) (bool, error) {
    47  	panic("indexJoinNode cannot be run in local mode")
    48  }
    49  
    50  func (n *indexJoinNode) Values() tree.Datums {
    51  	panic("indexJoinNode cannot be run in local mode")
    52  }
    53  
    54  func (n *indexJoinNode) Close(ctx context.Context) {
    55  	n.input.Close(ctx)
    56  	n.table.Close(ctx)
    57  }