Skip to content

Commit b7734fd

Browse files
authored
Merge pull request #185 from erizocosmico/fix/field-indexes
gitquery: do not handle index number fix anymore
2 parents 10826a3 + cc752ca commit b7734fd

File tree

1 file changed

+1
-25
lines changed

1 file changed

+1
-25
lines changed

filters.go

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -82,25 +82,6 @@ func filtersToExpression(filters []sql.Expression) sql.Expression {
8282
}
8383
}
8484

85-
// fixFieldIndexes transforms the given expression setting correct indexes
86-
// for GetField expressions according to the schema of the row in the table
87-
// and not the one where the filter came from.
88-
func fixFieldIndexes(schema sql.Schema, exp sql.Expression) (sql.Expression, error) {
89-
return exp.TransformUp(func(e sql.Expression) (sql.Expression, error) {
90-
switch e := e.(type) {
91-
case *expression.GetField:
92-
// we need to rewrite the indexes for the table row
93-
for i, col := range schema {
94-
if e.Name() == col.Name {
95-
return expression.NewGetField(i, e.Type(), e.Name(), e.IsNullable()), nil
96-
}
97-
}
98-
}
99-
100-
return e, nil
101-
})
102-
}
103-
10485
// canHandleEquals returns whether the given equals expression can be handled
10586
// as a selector. For that to happen one of the sides must be a GetField expr
10687
// that exists in the given schema and the other must be a literal.
@@ -294,12 +275,7 @@ func rowIterWithSelectors(
294275
return iter, nil
295276
}
296277

297-
cond, err := fixFieldIndexes(blobsSchema, filtersToExpression(filters))
298-
if err != nil {
299-
return nil, err
300-
}
301-
302-
return plan.NewFilterIter(session, cond, iter), nil
278+
return plan.NewFilterIter(session, expression.JoinAnd(filters...), iter), nil
303279
}
304280

305281
func stringContains(slice []string, target string) bool {

0 commit comments

Comments
 (0)