We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d57c0ac commit afb4d60Copy full SHA for afb4d60
sstable/block/compression_stats.go
@@ -38,8 +38,12 @@ type CompressionStatsForSetting struct {
38
UncompressedBytes uint64
39
}
40
41
-// CompressionRatio returns the compression ratio for the setting.
+// CompressionRatio returns the compression ratio for the setting. Returns 0 if
42
+// the stats are empty.
43
func (cs CompressionStatsForSetting) CompressionRatio() float64 {
44
+ if cs.CompressedBytes == 0 {
45
+ return 0
46
+ }
47
return float64(cs.UncompressedBytes) / float64(cs.CompressedBytes)
48
49
0 commit comments