Skip to content

Commit

Permalink
address comment
Browse files Browse the repository at this point in the history
  • Loading branch information
tiancaiamao committed Oct 26, 2021
1 parent ae8f98c commit cf09f32
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions expression/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10412,6 +10412,7 @@ PARTITION p20210907 VALUES LESS THAN (1631030400),
PARTITION p20210908 VALUES LESS THAN (1631116800),
PARTITION p20210909 VALUES LESS THAN (1631203200)
);`)
tk.MustExec("set @@tidb_partition_prune_mode = 'static'")
tk.MustExec("INSERT INTO `perf_offline_day` VALUES ('dd082c8a-3bab-4431-943a-348fe0592abd','2021-09-08 13:00:07','Xg9C8zq81jGNbugM', 'pc', 12345);")
tk.MustQuery("SELECT cast(floor(hour(ts) / 4) as char) as win_start FROM perf_offline_day partition (p20210907, p20210908) GROUP BY win_start;").Check(testkit.Rows("3"))
}
7 changes: 3 additions & 4 deletions expression/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,12 +231,11 @@ func ColumnSubstituteImpl(expr Expression, schema *Schema, newExprs []Expression
substituted, newFunc.GetArgs()[0] = ColumnSubstituteImpl(newFunc.GetArgs()[0], schema, newExprs)
if substituted {
// Workaround for issue https://github.com/pingcap/tidb/issues/28804
refExprArr := cowExprRef{v.GetArgs(), nil}
e := NewFunctionInternal(v.GetCtx(), v.FuncName.L, v.RetType, refExprArr.Result()...)
e.SetCoercibility(newFunc.Coercibility())
e := NewFunctionInternal(v.GetCtx(), v.FuncName.L, v.RetType, newFunc.GetArgs()...)
e.SetCoercibility(v.Coercibility())
return true, e
}
return true, newFunc
return false, newFunc
}
// cowExprRef is a copy-on-write util, args array allocation happens only
// when expr in args is changed
Expand Down

0 comments on commit cf09f32

Please sign in to comment.