Skip to content

Commit 725599e

Browse files
Add skipped columns information (#505)
1 parent 550d774 commit 725599e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

replication/row_event.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -846,7 +846,8 @@ type RowsEvent struct {
846846
ColumnBitmap2 []byte
847847

848848
//rows: invalid: int64, float64, bool, []byte, string
849-
Rows [][]interface{}
849+
Rows [][]interface{}
850+
SkippedColumns [][]int
850851

851852
parseTime bool
852853
timestampStringLocation *time.Location
@@ -907,6 +908,7 @@ func (e *RowsEvent) Decode(data []byte) error {
907908
if e.needBitmap2 {
908909
rowsLen += e.ColumnCount
909910
}
911+
e.SkippedColumns = make([][]int, 0, rowsLen)
910912
e.Rows = make([][]interface{}, 0, rowsLen)
911913

912914
for pos < len(data) {
@@ -932,6 +934,7 @@ func isBitSet(bitmap []byte, i int) bool {
932934

933935
func (e *RowsEvent) decodeRows(data []byte, table *TableMapEvent, bitmap []byte) (int, error) {
934936
row := make([]interface{}, e.ColumnCount)
937+
skips := make([]int, 0)
935938

936939
pos := 0
937940

@@ -953,6 +956,7 @@ func (e *RowsEvent) decodeRows(data []byte, table *TableMapEvent, bitmap []byte)
953956
var err error
954957
for i := 0; i < int(e.ColumnCount); i++ {
955958
if !isBitSet(bitmap, i) {
959+
skips = append(skips, i)
956960
continue
957961
}
958962

@@ -973,6 +977,7 @@ func (e *RowsEvent) decodeRows(data []byte, table *TableMapEvent, bitmap []byte)
973977
}
974978

975979
e.Rows = append(e.Rows, row)
980+
e.SkippedColumns = append(e.SkippedColumns, skips)
976981
return pos, nil
977982
}
978983

0 commit comments

Comments
 (0)