Skip to content

Commit

Permalink
hrpc: don't always expect partials for scan
Browse files Browse the repository at this point in the history
Older hbase versions (e.g. 1.0.x) do not support partials. If partials aren't
provided by the regionserver then treat the cell results as complete.

Closes #81
  • Loading branch information
Inphi committed May 26, 2019
1 parent 24ffed0 commit 6fdb4a7
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions hrpc/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,16 +228,23 @@ func (s *Scan) NewResponse() proto.Message {
func (s *Scan) DeserializeCellBlocks(m proto.Message, b []byte) (uint32, error) {
scanResp := m.(*pb.ScanResponse)
partials := scanResp.GetPartialFlagPerResult()
scanResp.Results = make([]*pb.Result, len(partials))
cellsPerResult := scanResp.GetCellsPerResult()
if len(partials) == 0 {
scanResp.Results = make([]*pb.Result, len(cellsPerResult))
} else {
scanResp.Results = make([]*pb.Result, len(partials))
}
var readLen uint32
for i, numCells := range scanResp.GetCellsPerResult() {
for i, numCells := range cellsPerResult {
cells, l, err := deserializeCellBlocks(b[readLen:], numCells)
if err != nil {
return 0, err
}
scanResp.Results[i] = &pb.Result{
Cell: cells,
Partial: proto.Bool(partials[i]),
scanResp.Results[i] = &pb.Result{Cell: cells}
if len(partials) == 0 {
scanResp.Results[i].Partial = proto.Bool(false)
} else {
scanResp.Results[i].Partial = proto.Bool(partials[i])
}
readLen += l
}
Expand Down

0 comments on commit 6fdb4a7

Please sign in to comment.