code: func (b *batchChecker) getKeysNeedCheck(ctx sessionctx.Context, t table.Table, rows [][]types.Datum) ([]toBeCheckedRow, error) {
  	nUnique := 0
  	for _, v := range t.WritableIndices() {
  		if v.Meta().Unique {
  			nUnique++
  		}
  	}
  	toBeCheckRows := make([]toBeCheckedRow, 0, len(rows))
  
  	var handleCol *table.Column
  	// Get handle column if PK is handle.
  	if t.Meta().PKIsHandle {
  		for _, col := range t.Cols() {
  			if col.IsPKHandleColumn(t.Meta()) {
  				handleCol = col
  				break
  			}
  		}
  	}
  
  	var err error
  	for _, row := range rows {
  		toBeCheckRows, err = b.getKeysNeedCheckOneRow(ctx, t, row, nUnique, handleCol, toBeCheckRows)
  		if err != nil {
  			return nil, err
  		}
  	}
  	return toBeCheckRows, nil
  }
docs: // getKeysNeedCheck gets keys converted from to-be-insert rows to record keys and unique index keys,
  // which need to be checked whether they are duplicate keys.