expression: don't use names when do patition pruning (#11858)

This commit is contained in:
Yiding Cui
2019-08-26 13:53:11 +08:00
committed by pingcap-github-bot
parent 4aa1411e3d
commit 236f6dcfef

View File

@ -256,17 +256,10 @@ func ruleColumnOPConst(ctx sessionctx.Context, i, j int, exprs *exprSet) {
// Make sure col1 and col2 are the same column.
// Can't use col1.Equal(ctx, col2) here, because they are not generated in one
// expression and their UniqueID are not the same.
if col1.ColName.L != col2.ColName.L {
return
}
if col1.OrigColName.L != "" &&
col2.OrigColName.L != "" &&
col1.OrigColName.L != col2.OrigColName.L {
return
}
if col1.OrigTblName.L != "" &&
col2.OrigTblName.L != "" &&
col1.OrigColName.L != col2.OrigColName.L {
// NOTE: We can use this way to compare this two column since this method is only called for partition pruning,
// where all columns come from the same DataSource.
// If we want to use this method in more places. We need to first change the comparing way.
if col1.ID != col2.ID {
return
}
v, isNull, err := compareConstant(ctx, negOP(OP2), fc1, con2)