зеркало из https://github.com/github/vitess-gh.git
vtgate sql: colnum -> colNumber
colnum and column looked too similar and confusing. Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
This commit is contained in:
Родитель
e1acadea40
Коммит
86ac31907e
|
@ -61,7 +61,7 @@ type builder interface {
|
|||
// a resultColumn entry and return it. The top level caller
|
||||
// must accumulate these result columns and set the symtab
|
||||
// after analysis.
|
||||
PushSelect(pb *primitiveBuilder, expr *sqlparser.AliasedExpr, origin builder) (rc *resultColumn, colnum int, err error)
|
||||
PushSelect(pb *primitiveBuilder, expr *sqlparser.AliasedExpr, origin builder) (rc *resultColumn, colNumber int, err error)
|
||||
|
||||
// MakeDistinct makes the primitive handle the distinct clause.
|
||||
MakeDistinct() error
|
||||
|
@ -100,7 +100,7 @@ type builder interface {
|
|||
// is different from PushSelect because it may reuse an existing
|
||||
// resultColumn, whereas PushSelect guarantees the addition of a new
|
||||
// result column and returns a distinct symbol for it.
|
||||
SupplyCol(col *sqlparser.ColName) (rc *resultColumn, colnum int)
|
||||
SupplyCol(col *sqlparser.ColName) (rc *resultColumn, colNumber int)
|
||||
|
||||
// Primitive returns the underlying primitive.
|
||||
// This function should only be called after Wireup is finished.
|
||||
|
@ -147,7 +147,7 @@ func (bc *builderCommon) SupplyVar(from, to int, col *sqlparser.ColName, varname
|
|||
bc.input.SupplyVar(from, to, col, varname)
|
||||
}
|
||||
|
||||
func (bc *builderCommon) SupplyCol(col *sqlparser.ColName) (rc *resultColumn, colnum int) {
|
||||
func (bc *builderCommon) SupplyCol(col *sqlparser.ColName) (rc *resultColumn, colNumber int) {
|
||||
return bc.input.SupplyCol(col)
|
||||
}
|
||||
|
||||
|
|
|
@ -154,24 +154,24 @@ func (jb *join) PushFilter(pb *primitiveBuilder, filter sqlparser.Expr, whereTyp
|
|||
}
|
||||
|
||||
// PushSelect satisfies the builder interface.
|
||||
func (jb *join) PushSelect(pb *primitiveBuilder, expr *sqlparser.AliasedExpr, origin builder) (rc *resultColumn, colnum int, err error) {
|
||||
func (jb *join) PushSelect(pb *primitiveBuilder, expr *sqlparser.AliasedExpr, origin builder) (rc *resultColumn, colNumber int, err error) {
|
||||
if jb.isOnLeft(origin.Order()) {
|
||||
rc, colnum, err = jb.Left.PushSelect(pb, expr, origin)
|
||||
rc, colNumber, err = jb.Left.PushSelect(pb, expr, origin)
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
jb.ejoin.Cols = append(jb.ejoin.Cols, -colnum-1)
|
||||
jb.ejoin.Cols = append(jb.ejoin.Cols, -colNumber-1)
|
||||
} else {
|
||||
// Pushing of non-trivial expressions not allowed for RHS of left joins.
|
||||
if _, ok := expr.Expr.(*sqlparser.ColName); !ok && jb.ejoin.Opcode == engine.LeftJoin {
|
||||
return nil, 0, errors.New("unsupported: cross-shard left join and column expressions")
|
||||
}
|
||||
|
||||
rc, colnum, err = jb.Right.PushSelect(pb, expr, origin)
|
||||
rc, colNumber, err = jb.Right.PushSelect(pb, expr, origin)
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
jb.ejoin.Cols = append(jb.ejoin.Cols, colnum+1)
|
||||
jb.ejoin.Cols = append(jb.ejoin.Cols, colNumber+1)
|
||||
}
|
||||
jb.resultColumns = append(jb.resultColumns, rc)
|
||||
return rc, len(jb.resultColumns) - 1, nil
|
||||
|
@ -316,7 +316,7 @@ func (jb *join) SupplyVar(from, to int, col *sqlparser.ColName, varname string)
|
|||
}
|
||||
|
||||
// SupplyCol satisfies the builder interface.
|
||||
func (jb *join) SupplyCol(col *sqlparser.ColName) (rc *resultColumn, colnum int) {
|
||||
func (jb *join) SupplyCol(col *sqlparser.ColName) (rc *resultColumn, colNumber int) {
|
||||
c := col.Metadata.(*column)
|
||||
for i, rc := range jb.resultColumns {
|
||||
if rc.column == c {
|
||||
|
|
|
@ -56,7 +56,7 @@ func (l *limit) PushFilter(_ *primitiveBuilder, _ sqlparser.Expr, whereType stri
|
|||
}
|
||||
|
||||
// PushSelect satisfies the builder interface.
|
||||
func (l *limit) PushSelect(_ *primitiveBuilder, expr *sqlparser.AliasedExpr, origin builder) (rc *resultColumn, colnum int, err error) {
|
||||
func (l *limit) PushSelect(_ *primitiveBuilder, expr *sqlparser.AliasedExpr, origin builder) (rc *resultColumn, colNumber int, err error) {
|
||||
return nil, 0, errors.New("limit.PushSelect: unreachable")
|
||||
}
|
||||
|
||||
|
|
|
@ -45,18 +45,18 @@ func newMemorySort(bldr builder, orderBy sqlparser.OrderBy) (*memorySort, error)
|
|||
eMemorySort: &engine.MemorySort{},
|
||||
}
|
||||
for _, order := range orderBy {
|
||||
colnum := -1
|
||||
colNumber := -1
|
||||
switch expr := order.Expr.(type) {
|
||||
case *sqlparser.SQLVal:
|
||||
var err error
|
||||
if colnum, err = ResultFromNumber(ms.ResultColumns(), expr); err != nil {
|
||||
if colNumber, err = ResultFromNumber(ms.ResultColumns(), expr); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
case *sqlparser.ColName:
|
||||
c := expr.Metadata.(*column)
|
||||
for i, rc := range ms.ResultColumns() {
|
||||
if rc.column == c {
|
||||
colnum = i
|
||||
colNumber = i
|
||||
break
|
||||
}
|
||||
}
|
||||
|
@ -65,11 +65,11 @@ func newMemorySort(bldr builder, orderBy sqlparser.OrderBy) (*memorySort, error)
|
|||
}
|
||||
// If column is not found, then the order by is referencing
|
||||
// a column that's not on the select list.
|
||||
if colnum == -1 {
|
||||
if colNumber == -1 {
|
||||
return nil, fmt.Errorf("unsupported: memory sort: order by must reference a column in the select list: %s", sqlparser.String(order))
|
||||
}
|
||||
ob := engine.OrderbyParams{
|
||||
Col: colnum,
|
||||
Col: colNumber,
|
||||
Desc: order.Direction == sqlparser.DescScr,
|
||||
}
|
||||
ms.eMemorySort.OrderBy = append(ms.eMemorySort.OrderBy, ob)
|
||||
|
@ -94,7 +94,7 @@ func (ms *memorySort) PushFilter(_ *primitiveBuilder, _ sqlparser.Expr, whereTyp
|
|||
}
|
||||
|
||||
// PushSelect satisfies the builder interface.
|
||||
func (ms *memorySort) PushSelect(_ *primitiveBuilder, expr *sqlparser.AliasedExpr, origin builder) (rc *resultColumn, colnum int, err error) {
|
||||
func (ms *memorySort) PushSelect(_ *primitiveBuilder, expr *sqlparser.AliasedExpr, origin builder) (rc *resultColumn, colNumber int, err error) {
|
||||
return nil, 0, errors.New("memorySort.PushSelect: unreachable")
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ func (ms *mergeSort) PushFilter(pb *primitiveBuilder, expr sqlparser.Expr, where
|
|||
}
|
||||
|
||||
// PushSelect satisfies the builder interface.
|
||||
func (ms *mergeSort) PushSelect(pb *primitiveBuilder, expr *sqlparser.AliasedExpr, origin builder) (rc *resultColumn, colnum int, err error) {
|
||||
func (ms *mergeSort) PushSelect(pb *primitiveBuilder, expr *sqlparser.AliasedExpr, origin builder) (rc *resultColumn, colNumber int, err error) {
|
||||
return ms.input.PushSelect(pb, expr, origin)
|
||||
}
|
||||
|
||||
|
|
|
@ -282,7 +282,7 @@ func (oa *orderedAggregate) PushFilter(_ *primitiveBuilder, _ sqlparser.Expr, wh
|
|||
// MAX sent to the route will not be added to symtab and will not be reachable by
|
||||
// others. This functionality depends on the PushOrderBy to request that
|
||||
// the rows be correctly ordered.
|
||||
func (oa *orderedAggregate) PushSelect(pb *primitiveBuilder, expr *sqlparser.AliasedExpr, origin builder) (rc *resultColumn, colnum int, err error) {
|
||||
func (oa *orderedAggregate) PushSelect(pb *primitiveBuilder, expr *sqlparser.AliasedExpr, origin builder) (rc *resultColumn, colNumber int, err error) {
|
||||
if inner, ok := expr.Expr.(*sqlparser.FuncExpr); ok {
|
||||
if _, ok := engine.SupportedAggregates[inner.Name.Lowered()]; ok {
|
||||
return oa.pushAggr(pb, expr, origin)
|
||||
|
@ -299,7 +299,7 @@ func (oa *orderedAggregate) PushSelect(pb *primitiveBuilder, expr *sqlparser.Ali
|
|||
return innerRC, len(oa.resultColumns) - 1, nil
|
||||
}
|
||||
|
||||
func (oa *orderedAggregate) pushAggr(pb *primitiveBuilder, expr *sqlparser.AliasedExpr, origin builder) (rc *resultColumn, colnum int, err error) {
|
||||
func (oa *orderedAggregate) pushAggr(pb *primitiveBuilder, expr *sqlparser.AliasedExpr, origin builder) (rc *resultColumn, colNumber int, err error) {
|
||||
funcExpr := expr.Expr.(*sqlparser.FuncExpr)
|
||||
opcode := engine.SupportedAggregates[funcExpr.Name.Lowered()]
|
||||
if len(funcExpr.Exprs) != 1 {
|
||||
|
@ -396,7 +396,7 @@ func (oa *orderedAggregate) MakeDistinct() error {
|
|||
|
||||
// PushGroupBy satisfies the builder interface.
|
||||
func (oa *orderedAggregate) PushGroupBy(groupBy sqlparser.GroupBy) error {
|
||||
colnum := -1
|
||||
colNumber := -1
|
||||
for _, expr := range groupBy {
|
||||
switch node := expr.(type) {
|
||||
case *sqlparser.ColName:
|
||||
|
@ -406,11 +406,11 @@ func (oa *orderedAggregate) PushGroupBy(groupBy sqlparser.GroupBy) error {
|
|||
}
|
||||
for i, rc := range oa.resultColumns {
|
||||
if rc.column == c {
|
||||
colnum = i
|
||||
colNumber = i
|
||||
break
|
||||
}
|
||||
}
|
||||
if colnum == -1 {
|
||||
if colNumber == -1 {
|
||||
return errors.New("unsupported: in scatter query: group by column must reference column in SELECT list")
|
||||
}
|
||||
case *sqlparser.SQLVal:
|
||||
|
@ -418,11 +418,11 @@ func (oa *orderedAggregate) PushGroupBy(groupBy sqlparser.GroupBy) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
colnum = num
|
||||
colNumber = num
|
||||
default:
|
||||
return errors.New("unsupported: in scatter query: only simple references allowed")
|
||||
}
|
||||
oa.eaggr.Keys = append(oa.eaggr.Keys, colnum)
|
||||
oa.eaggr.Keys = append(oa.eaggr.Keys, colNumber)
|
||||
}
|
||||
// Append the distinct aggregate if any.
|
||||
if oa.extraDistinct != nil {
|
||||
|
@ -541,11 +541,11 @@ func (oa *orderedAggregate) PushMisc(sel *sqlparser.Select) {
|
|||
// compare those instead. This is because we currently don't have the
|
||||
// ability to mimic mysql's collation behavior.
|
||||
func (oa *orderedAggregate) Wireup(bldr builder, jt *jointab) error {
|
||||
for i, colnum := range oa.eaggr.Keys {
|
||||
if sqltypes.IsText(oa.resultColumns[colnum].column.typ) {
|
||||
for i, colNumber := range oa.eaggr.Keys {
|
||||
if sqltypes.IsText(oa.resultColumns[colNumber].column.typ) {
|
||||
// len(oa.resultColumns) does not change. No harm using the value multiple times.
|
||||
oa.eaggr.TruncateColumnCount = len(oa.resultColumns)
|
||||
oa.eaggr.Keys[i] = oa.input.SupplyWeightString(colnum)
|
||||
oa.eaggr.Keys[i] = oa.input.SupplyWeightString(colNumber)
|
||||
}
|
||||
}
|
||||
return oa.input.Wireup(bldr, jt)
|
||||
|
@ -557,6 +557,6 @@ func (oa *orderedAggregate) SupplyVar(from, to int, col *sqlparser.ColName, varn
|
|||
}
|
||||
|
||||
// SupplyCol satisfies the builder interface.
|
||||
func (oa *orderedAggregate) SupplyCol(col *sqlparser.ColName) (rc *resultColumn, colnum int) {
|
||||
func (oa *orderedAggregate) SupplyCol(col *sqlparser.ColName) (rc *resultColumn, colNumber int) {
|
||||
panic("BUG: nothing should depend on orderedAggregate")
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ func (ps *pulloutSubquery) PushFilter(pb *primitiveBuilder, filter sqlparser.Exp
|
|||
}
|
||||
|
||||
// PushSelect satisfies the builder interface.
|
||||
func (ps *pulloutSubquery) PushSelect(pb *primitiveBuilder, expr *sqlparser.AliasedExpr, origin builder) (rc *resultColumn, colnum int, err error) {
|
||||
func (ps *pulloutSubquery) PushSelect(pb *primitiveBuilder, expr *sqlparser.AliasedExpr, origin builder) (rc *resultColumn, colNumber int, err error) {
|
||||
return ps.underlying.PushSelect(pb, expr, origin)
|
||||
}
|
||||
|
||||
|
@ -142,6 +142,6 @@ func (ps *pulloutSubquery) SupplyVar(from, to int, col *sqlparser.ColName, varna
|
|||
}
|
||||
|
||||
// SupplyCol satisfies the builder interface.
|
||||
func (ps *pulloutSubquery) SupplyCol(col *sqlparser.ColName) (rc *resultColumn, colnum int) {
|
||||
func (ps *pulloutSubquery) SupplyCol(col *sqlparser.ColName) (rc *resultColumn, colNumber int) {
|
||||
panic("BUG: unreachable")
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ func (rb *route) UpdatePlans(pb *primitiveBuilder, filter sqlparser.Expr) {
|
|||
}
|
||||
|
||||
// PushSelect satisfies the builder interface.
|
||||
func (rb *route) PushSelect(_ *primitiveBuilder, expr *sqlparser.AliasedExpr, _ builder) (rc *resultColumn, colnum int, err error) {
|
||||
func (rb *route) PushSelect(_ *primitiveBuilder, expr *sqlparser.AliasedExpr, _ builder) (rc *resultColumn, colNumber int, err error) {
|
||||
sel := rb.Select.(*sqlparser.Select)
|
||||
sel.SelectExprs = append(sel.SelectExprs, expr)
|
||||
|
||||
|
@ -190,18 +190,18 @@ func (rb *route) PushOrderBy(orderBy sqlparser.OrderBy) (builder, error) {
|
|||
|
||||
// If it's a scatter, we have to populate the OrderBy field.
|
||||
for _, order := range orderBy {
|
||||
colnum := -1
|
||||
colNumber := -1
|
||||
switch expr := order.Expr.(type) {
|
||||
case *sqlparser.SQLVal:
|
||||
var err error
|
||||
if colnum, err = ResultFromNumber(rb.resultColumns, expr); err != nil {
|
||||
if colNumber, err = ResultFromNumber(rb.resultColumns, expr); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
case *sqlparser.ColName:
|
||||
c := expr.Metadata.(*column)
|
||||
for i, rc := range rb.resultColumns {
|
||||
if rc.column == c {
|
||||
colnum = i
|
||||
colNumber = i
|
||||
break
|
||||
}
|
||||
}
|
||||
|
@ -210,11 +210,11 @@ func (rb *route) PushOrderBy(orderBy sqlparser.OrderBy) (builder, error) {
|
|||
}
|
||||
// If column is not found, then the order by is referencing
|
||||
// a column that's not on the select list.
|
||||
if colnum == -1 {
|
||||
if colNumber == -1 {
|
||||
return nil, fmt.Errorf("unsupported: in scatter query: order by must reference a column in the select list: %s", sqlparser.String(order))
|
||||
}
|
||||
ob := engine.OrderbyParams{
|
||||
Col: colnum,
|
||||
Col: colNumber,
|
||||
Desc: order.Direction == sqlparser.DescScr,
|
||||
}
|
||||
for _, ro := range rb.routeOptions {
|
||||
|
@ -282,8 +282,8 @@ func (rb *route) Wireup(bldr builder, jt *jointab) error {
|
|||
if sqltypes.IsText(rc.column.typ) {
|
||||
// If a weight string was previously requested (by OrderedAggregator),
|
||||
// reuse it.
|
||||
if colnum, ok := rb.weightStrings[rc]; ok {
|
||||
ro.eroute.OrderBy[i].Col = colnum
|
||||
if colNumber, ok := rb.weightStrings[rc]; ok {
|
||||
ro.eroute.OrderBy[i].Col = colNumber
|
||||
continue
|
||||
}
|
||||
|
||||
|
@ -439,7 +439,7 @@ func (rb *route) SupplyVar(from, to int, col *sqlparser.ColName, varname string)
|
|||
}
|
||||
|
||||
// SupplyCol satisfies the builder interface.
|
||||
func (rb *route) SupplyCol(col *sqlparser.ColName) (rc *resultColumn, colnum int) {
|
||||
func (rb *route) SupplyCol(col *sqlparser.ColName) (rc *resultColumn, colNumber int) {
|
||||
c := col.Metadata.(*column)
|
||||
for i, rc := range rb.resultColumns {
|
||||
if rc.column == c {
|
||||
|
@ -455,23 +455,23 @@ func (rb *route) SupplyCol(col *sqlparser.ColName) (rc *resultColumn, colnum int
|
|||
return rc, len(rb.resultColumns) - 1
|
||||
}
|
||||
|
||||
func (rb *route) SupplyWeightString(colnum int) (weightColnum int) {
|
||||
rc := rb.resultColumns[colnum]
|
||||
if weightColnum, ok := rb.weightStrings[rc]; ok {
|
||||
return weightColnum
|
||||
func (rb *route) SupplyWeightString(colNumber int) (weightcolNumber int) {
|
||||
rc := rb.resultColumns[colNumber]
|
||||
if weightcolNumber, ok := rb.weightStrings[rc]; ok {
|
||||
return weightcolNumber
|
||||
}
|
||||
expr := &sqlparser.AliasedExpr{
|
||||
Expr: &sqlparser.FuncExpr{
|
||||
Name: sqlparser.NewColIdent("weight_string"),
|
||||
Exprs: []sqlparser.SelectExpr{
|
||||
rb.Select.(*sqlparser.Select).SelectExprs[colnum],
|
||||
rb.Select.(*sqlparser.Select).SelectExprs[colNumber],
|
||||
},
|
||||
},
|
||||
}
|
||||
// It's ok to pass nil for pb and builder because PushSelect doesn't use them.
|
||||
_, weightColnum, _ = rb.PushSelect(nil, expr, nil)
|
||||
rb.weightStrings[rc] = weightColnum
|
||||
return weightColnum
|
||||
_, weightcolNumber, _ = rb.PushSelect(nil, expr, nil)
|
||||
rb.weightStrings[rc] = weightcolNumber
|
||||
return weightcolNumber
|
||||
}
|
||||
|
||||
// BuildColName builds a *sqlparser.ColName for the resultColumn specified
|
||||
|
|
|
@ -90,14 +90,14 @@ func (sq *subquery) PushFilter(_ *primitiveBuilder, _ sqlparser.Expr, whereType
|
|||
}
|
||||
|
||||
// PushSelect satisfies the builder interface.
|
||||
func (sq *subquery) PushSelect(_ *primitiveBuilder, expr *sqlparser.AliasedExpr, _ builder) (rc *resultColumn, colnum int, err error) {
|
||||
func (sq *subquery) PushSelect(_ *primitiveBuilder, expr *sqlparser.AliasedExpr, _ builder) (rc *resultColumn, colNumber int, err error) {
|
||||
col, ok := expr.Expr.(*sqlparser.ColName)
|
||||
if !ok {
|
||||
return nil, 0, errors.New("unsupported: expression on results of a cross-shard subquery")
|
||||
}
|
||||
|
||||
// colnum should already be set for subquery columns.
|
||||
inner := col.Metadata.(*column).colnum
|
||||
// colNumber should already be set for subquery columns.
|
||||
inner := col.Metadata.(*column).colNumber
|
||||
sq.esubquery.Cols = append(sq.esubquery.Cols, inner)
|
||||
|
||||
// Build a new column reference to represent the result column.
|
||||
|
@ -129,7 +129,7 @@ func (sq *subquery) PushOrderBy(orderBy sqlparser.OrderBy) (builder, error) {
|
|||
}
|
||||
|
||||
// SupplyCol satisfies the builder interface.
|
||||
func (sq *subquery) SupplyCol(col *sqlparser.ColName) (rc *resultColumn, colnum int) {
|
||||
func (sq *subquery) SupplyCol(col *sqlparser.ColName) (rc *resultColumn, colNumber int) {
|
||||
c := col.Metadata.(*column)
|
||||
for i, rc := range sq.resultColumns {
|
||||
if rc.column == c {
|
||||
|
@ -137,9 +137,9 @@ func (sq *subquery) SupplyCol(col *sqlparser.ColName) (rc *resultColumn, colnum
|
|||
}
|
||||
}
|
||||
|
||||
// columns that reference subqueries will have their colnum set.
|
||||
// columns that reference subqueries will have their colNumber set.
|
||||
// Let's use it here.
|
||||
sq.esubquery.Cols = append(sq.esubquery.Cols, c.colnum)
|
||||
sq.esubquery.Cols = append(sq.esubquery.Cols, c.colNumber)
|
||||
sq.resultColumns = append(sq.resultColumns, &resultColumn{column: c})
|
||||
return rc, len(sq.resultColumns) - 1
|
||||
}
|
||||
|
|
|
@ -436,7 +436,7 @@ func (t *table) addColumn(alias sqlparser.ColIdent, c *column) {
|
|||
lowered := alias.Lowered()
|
||||
// Dups are allowed, but first one wins if referenced.
|
||||
if _, ok := t.columns[lowered]; !ok {
|
||||
c.colnum = len(t.columnNames)
|
||||
c.colNumber = len(t.columnNames)
|
||||
t.columns[lowered] = c
|
||||
}
|
||||
t.columnNames = append(t.columnNames, alias)
|
||||
|
@ -457,7 +457,7 @@ func (t *table) mergeColumn(alias sqlparser.ColIdent, c *column) (*column, error
|
|||
if t.isAuthoritative {
|
||||
return nil, fmt.Errorf("column %v not found in %v", sqlparser.String(alias), sqlparser.String(t.alias))
|
||||
}
|
||||
c.colnum = len(t.columnNames)
|
||||
c.colNumber = len(t.columnNames)
|
||||
t.columns[lowered] = c
|
||||
t.columnNames = append(t.columnNames, alias)
|
||||
return c, nil
|
||||
|
@ -478,13 +478,13 @@ func (t *table) Origin() builder {
|
|||
//
|
||||
// Two columns are equal if their pointer values match.
|
||||
//
|
||||
// For subquery and vindexFunc, the colnum is also set because
|
||||
// For subquery and vindexFunc, the colNumber is also set because
|
||||
// the column order is known and unchangeable.
|
||||
type column struct {
|
||||
origin builder
|
||||
st *symtab
|
||||
typ querypb.Type
|
||||
colnum int
|
||||
origin builder
|
||||
st *symtab
|
||||
typ querypb.Type
|
||||
colNumber int
|
||||
}
|
||||
|
||||
// Origin returns the route that originates the column.
|
||||
|
|
|
@ -130,7 +130,7 @@ func (vf *vindexFunc) PushFilter(pb *primitiveBuilder, filter sqlparser.Expr, wh
|
|||
}
|
||||
|
||||
// PushSelect satisfies the builder interface.
|
||||
func (vf *vindexFunc) PushSelect(_ *primitiveBuilder, expr *sqlparser.AliasedExpr, _ builder) (rc *resultColumn, colnum int, err error) {
|
||||
func (vf *vindexFunc) PushSelect(_ *primitiveBuilder, expr *sqlparser.AliasedExpr, _ builder) (rc *resultColumn, colNumber int, err error) {
|
||||
// Catch the case where no where clause was specified. If so, the opcode
|
||||
// won't be set.
|
||||
if vf.eVindexFunc.Opcode == engine.VindexNone {
|
||||
|
@ -146,7 +146,7 @@ func (vf *vindexFunc) PushSelect(_ *primitiveBuilder, expr *sqlparser.AliasedExp
|
|||
Name: rc.alias.String(),
|
||||
Type: querypb.Type_VARBINARY,
|
||||
})
|
||||
vf.eVindexFunc.Cols = append(vf.eVindexFunc.Cols, col.Metadata.(*column).colnum)
|
||||
vf.eVindexFunc.Cols = append(vf.eVindexFunc.Cols, col.Metadata.(*column).colNumber)
|
||||
return rc, len(vf.resultColumns) - 1, nil
|
||||
}
|
||||
|
||||
|
@ -192,7 +192,7 @@ func (vf *vindexFunc) SupplyVar(from, to int, col *sqlparser.ColName, varname st
|
|||
}
|
||||
|
||||
// SupplyCol satisfies the builder interface.
|
||||
func (vf *vindexFunc) SupplyCol(col *sqlparser.ColName) (rc *resultColumn, colnum int) {
|
||||
func (vf *vindexFunc) SupplyCol(col *sqlparser.ColName) (rc *resultColumn, colNumber int) {
|
||||
c := col.Metadata.(*column)
|
||||
for i, rc := range vf.resultColumns {
|
||||
if rc.column == c {
|
||||
|
@ -206,8 +206,8 @@ func (vf *vindexFunc) SupplyCol(col *sqlparser.ColName) (rc *resultColumn, colnu
|
|||
Type: querypb.Type_VARBINARY,
|
||||
})
|
||||
|
||||
// columns that reference vindexFunc will have their colnum set.
|
||||
// columns that reference vindexFunc will have their colNumber set.
|
||||
// Let's use it here.
|
||||
vf.eVindexFunc.Cols = append(vf.eVindexFunc.Cols, c.colnum)
|
||||
vf.eVindexFunc.Cols = append(vf.eVindexFunc.Cols, c.colNumber)
|
||||
return rc, len(vf.resultColumns) - 1
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче