// newTableReader creates a tableReader. func newTableReader( flowCtx *FlowCtx, spec *TableReaderSpec, output RowReceiver, ) (*tableReader, error) { tr := &tableReader{ output: output, hardLimit: spec.HardLimit, softLimit: spec.SoftLimit, } if tr.hardLimit != 0 && tr.hardLimit < tr.softLimit { return nil, errors.Errorf("soft limit %d larger than hard limit %d", tr.softLimit, tr.hardLimit) } err := tr.readerBase.init(flowCtx, &spec.Table, int(spec.IndexIdx), spec.Filter, spec.OutputColumns, spec.Reverse) if err != nil { return nil, err } tr.ctx = log.WithLogTagInt(tr.flowCtx.Context, "TableReader", int(tr.desc.ID)) tr.spans = make(roachpb.Spans, len(spec.Spans)) for i, s := range spec.Spans { tr.spans[i] = s.Span } return tr, nil }
func newJoinReader( flowCtx *FlowCtx, spec *JoinReaderSpec, input RowSource, output RowReceiver, ) (*joinReader, error) { if spec.IndexIdx != 0 { // TODO(radu): for now we only support joining with the primary index return nil, errors.Errorf("join with index not implemented") } jr := &joinReader{ input: input, output: output, } err := jr.readerBase.init(flowCtx, &spec.Table, int(spec.IndexIdx), spec.Filter, spec.OutputColumns, false) if err != nil { return nil, err } jr.ctx = log.WithLogTagInt(jr.flowCtx.Context, "JoinReader", int(jr.desc.ID)) return jr, nil }