Skip to content
This repository was archived by the owner on Jan 28, 2021. It is now read-only.

Commit a385e34

Browse files
committed
Check if partition is Nameable in SHOW PROCESSLIST output
Signed-off-by: Carlos Martín <[email protected]>
1 parent 2f000c0 commit a385e34

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

Diff for: sql/plan/process.go

+10-3
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func (t *ProcessIndexableTable) PartitionRows(ctx *sql.Context, p sql.Partition)
8383
return nil, err
8484
}
8585

86-
partitionName := string(p.Key())
86+
partitionName := partitionName(p)
8787
if t.OnPartitionStart != nil {
8888
t.OnPartitionStart(partitionName)
8989
}
@@ -137,7 +137,7 @@ func (t *ProcessTable) PartitionRows(ctx *sql.Context, p sql.Partition) (sql.Row
137137
return nil, err
138138
}
139139

140-
partitionName := string(p.Key())
140+
partitionName := partitionName(p)
141141
if t.OnPartitionStart != nil {
142142
t.OnPartitionStart(partitionName)
143143
}
@@ -206,7 +206,7 @@ func (i *trackedPartitionIndexKeyValueIter) Next() (sql.Partition, sql.IndexKeyV
206206
return nil, nil, err
207207
}
208208

209-
partitionName := string(p.Key())
209+
partitionName := partitionName(p)
210210
if i.OnPartitionStart != nil {
211211
i.OnPartitionStart(partitionName)
212212
}
@@ -264,3 +264,10 @@ func (i *trackedIndexKeyValueIter) Next() ([]interface{}, []byte, error) {
264264

265265
return v, k, nil
266266
}
267+
268+
func partitionName(p sql.Partition) string {
269+
if n, ok := p.(sql.Nameable); ok {
270+
return n.Name()
271+
}
272+
return string(p.Key())
273+
}

0 commit comments

Comments
 (0)