예제 #1
0
파일: builder.go 프로젝트: AkihiroSuda/tidb
func (b *executorBuilder) buildTableScan(v *plan.TableScan) Executor {
	table, _ := b.is.TableByID(v.Table.ID)
	return &TableScanExec{
		t:          table,
		fields:     v.Fields(),
		ctx:        b.ctx,
		ranges:     v.Ranges,
		seekHandle: math.MinInt64,
	}
}
예제 #2
0
파일: builder.go 프로젝트: tutuhuagong/tidb
func (b *executorBuilder) buildTableScan(v *plan.TableScan) Executor {
	table, _ := b.is.TableByID(v.Table.ID)
	e := &TableScanExec{
		t:          table,
		fields:     v.Fields(),
		ctx:        b.ctx,
		ranges:     v.Ranges,
		seekHandle: math.MinInt64,
	}
	return b.buildFilter(e, v.FilterConditions)
}
예제 #3
0
파일: builder.go 프로젝트: astaxie/tidb
func (b *executorBuilder) buildTableScan(v *plan.TableScan) Executor {
	txn, err := b.ctx.GetTxn(false)
	if err != nil {
		b.err = err
		return nil
	}
	table, _ := b.is.TableByID(v.Table.ID)
	client := txn.GetClient()
	var memDB bool
	switch v.Fields()[0].DBName.L {
	case "information_schema", "performance_schema":
		memDB = true
	}
	if !memDB && client.SupportRequestType(kv.ReqTypeSelect, 0) && txn.IsReadOnly() {
		log.Debug("xapi select table")
		e := &XSelectTableExec{
			table:     table,
			ctx:       b.ctx,
			tablePlan: v,
		}
		where := conditionsToPBExpression(v.FilterConditions...)
		if xapi.SupportExpression(client, where) {
			e.where = where
			return e
		}
		return b.buildFilter(e, v.FilterConditions)
	}

	e := &TableScanExec{
		t:          table,
		fields:     v.Fields(),
		ctx:        b.ctx,
		ranges:     v.Ranges,
		seekHandle: math.MinInt64,
	}
	return b.buildFilter(e, v.FilterConditions)
}