executor: trim ( and ) for the outputs of expression (#26687)

This commit is contained in:
wjHuang
2021-07-28 15:20:17 +08:00
committed by GitHub
parent 3e25ee20a3
commit 583cdc8f13
4 changed files with 5 additions and 5 deletions

View File

@ -191,7 +191,7 @@ TABLE_SCHEMA TABLE_NAME NON_UNIQUE KEY_NAME SEQ_IN_INDEX COLUMN_NAME SUB_PART IN
test t4 0 PRIMARY 1 a NULL NULL 0 YES YES
test t4 1 idx 1 a NULL NULL 1 YES NO
test t4 1 idx 2 b NULL NULL 1 YES NO
test t4 1 expr_idx 1 NULL NULL (`a` + `b` + 1) 2 YES NO
test t4 1 expr_idx 1 NULL NULL `a` + `b` + 1 2 YES NO
explain format = 'brief' select count(1) from (select count(1) from (select * from t1 where c3 = 100) k) k2;
id estRows task access object operator info
StreamAgg 1.00 root funcs:count(1)->Column#5

View File

@ -438,7 +438,7 @@ func (e *memtableRetriever) setDataForStatisticsInTable(schema *model.DBInfo, ta
tblCol := table.Columns[col.Offset]
if tblCol.Hidden {
colName = "NULL"
expression = fmt.Sprintf("(%s)", tblCol.GeneratedExprString)
expression = tblCol.GeneratedExprString
}
record := types.MakeDatums(
@ -913,7 +913,7 @@ func (e *memtableRetriever) setDataFromIndexes(ctx sessionctx.Context, schemas [
tblCol := tb.Columns[col.Offset]
if tblCol.Hidden {
colName = "NULL"
expression = fmt.Sprintf("(%s)", tblCol.GeneratedExprString)
expression = tblCol.GeneratedExprString
}
visible := "YES"
if idxInfo.Invisible {

View File

@ -336,7 +336,7 @@ func (s *seqTestSuite) TestShow(c *C) {
"show_index|1|idx7|1|id|A|0|<nil>|<nil>||BTREE| |YES|<nil>|NO",
"show_index|1|idx8|1|id|A|0|<nil>|<nil>||BTREE| |YES|<nil>|NO",
"show_index|1|idx9|1|id|A|0|<nil>|<nil>||BTREE| |NO|<nil>|NO",
"show_index|1|expr_idx|1|NULL|A|0|<nil>|<nil>|YES|BTREE| |YES|(`id` * 2 + 1)|NO",
"show_index|1|expr_idx|1|NULL|A|0|<nil>|<nil>|YES|BTREE| |YES|`id` * 2 + 1|NO",
))
// For show like with escape

View File

@ -614,7 +614,7 @@ func (e *ShowExec) fetchShowIndex() error {
var expression interface{}
if tblCol.Hidden {
colName = "NULL"
expression = fmt.Sprintf("(%s)", tblCol.GeneratedExprString)
expression = tblCol.GeneratedExprString
}
e.appendRow([]interface{}{