func (b *executorBuilder) buildNewTableScan(v *plan.NewTableScan) 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.DBName.L { case "information_schema", "performance_schema": memDB = true } supportDesc := client.SupportRequestType(kv.ReqTypeSelect, kv.ReqSubTypeDesc) if !memDB && client.SupportRequestType(kv.ReqTypeSelect, 0) { // TODO: support union scan exec. return &NewTableScanExec{ tableInfo: v.Table, ctx: b.ctx, supportDesc: supportDesc, asName: v.TableAsName, table: table, schema: v.GetSchema(), Columns: v.Columns, ranges: v.Ranges, } } b.err = errors.New("Not implement yet.") return nil }
func (b *executorBuilder) buildNewTableScan(v *plan.NewTableScan, s *plan.Selection) 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.DBName.L { case "information_schema", "performance_schema": memDB = true } supportDesc := client.SupportRequestType(kv.ReqTypeSelect, kv.ReqSubTypeDesc) if !memDB && client.SupportRequestType(kv.ReqTypeSelect, 0) { var ret Executor st := &NewXSelectTableExec{ tableInfo: v.Table, ctx: b.ctx, supportDesc: supportDesc, asName: v.TableAsName, table: table, schema: v.GetSchema(), Columns: v.Columns, ranges: v.Ranges, } ret = st if !txn.IsReadOnly() { if s != nil { ret = b.buildNewUnionScanExec(ret, expression.ComposeCNFCondition(append(s.Conditions, v.AccessCondition...))) } else { ret = b.buildNewUnionScanExec(ret, nil) } } if s != nil { st.where, s.Conditions = b.toPBExpr(s.Conditions, st.tableInfo) } return ret } ts := &NewTableScanExec{ t: table, asName: v.TableAsName, ctx: b.ctx, columns: v.Columns, schema: v.GetSchema(), seekHandle: math.MinInt64, ranges: v.Ranges, } if v.Desc { b.err = errors.New("Not implement yet.") return nil } return ts }