Skip to content

Commit

Permalink
Extract Result#StatsEmpty
Browse files Browse the repository at this point in the history
Signed-off-by: Rafer Hazen <[email protected]>
  • Loading branch information
rafer committed Jul 25, 2024
1 parent f2e5c97 commit 8e9bccb
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions go/sqltypes/result.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,10 +324,9 @@ func (result *Result) StripMetadata(incl querypb.ExecuteOptions_IncludedFields)
// to another result.Note currently it doesn't handle cases like
// if two results have different fields.We will enhance this function.
func (result *Result) AppendResult(src *Result) {
if src.RowsAffected == 0 && len(src.Rows) == 0 && len(src.Fields) == 0 {
if src.StatsEmpty() && len(src.Rows) == 0 && len(src.Fields) == 0 {
return
}

if result.Fields == nil {
result.Fields = src.Fields
}
Expand All @@ -345,6 +344,10 @@ func (result *Result) Stats() *Result {
}
}

func (result *Result) StatsEmpty() bool {
return result.RowsAffected == 0
}

// MergeStats updates the receiver's stats by merging in the stats from src.
func (result *Result) MergeStats(src *Result) {
result.RowsAffected += src.RowsAffected
Expand Down

0 comments on commit 8e9bccb

Please sign in to comment.