Skip to content

Commit

Permalink
fix: Divide Checksum By 2
Browse files Browse the repository at this point in the history
Because we need int64 and not uint64.
  • Loading branch information
kangoo13 committed Sep 22, 2020
1 parent 3778702 commit 33938fa
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion clickhouse.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ func (h *clickhouse) afterLoad(q queryable) error {
}

func (h *clickhouse) getChecksum(q queryable, tableName string) (int64, error) {
query := fmt.Sprintf("SELECT groupBitXor(cityHash64(*)) FROM %s", h.quoteKeyword(tableName))
// This is an equivalent query to get the checksum of the content of the table
// We divide by 2 because it returns an uint64 instead of an int64
query := fmt.Sprintf("SELECT toInt64(groupBitXor(cityHash64(*)) / 2) FROM %s", h.quoteKeyword(tableName))
var (
checksum sql.NullInt64
)
Expand Down

0 comments on commit 33938fa

Please sign in to comment.