From 42b56b806cb6d084e084cbac2b423248ab714c0d Mon Sep 17 00:00:00 2001 From: Dmitry Kropachev Date: Sun, 6 Aug 2023 17:52:53 -0400 Subject: [PATCH] fix(typedef): ValueVariationsNumber returns zero all the time --- pkg/typedef/columns.go | 2 +- pkg/typedef/interfaces.go | 2 +- pkg/typedef/tuple.go | 2 +- pkg/typedef/udt.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/typedef/columns.go b/pkg/typedef/columns.go index 1333a41..34f1da1 100644 --- a/pkg/typedef/columns.go +++ b/pkg/typedef/columns.go @@ -148,7 +148,7 @@ func (c Columns) NonCounters() Columns { // ValueVariationsNumber returns number of bytes generated value holds func (c Columns) ValueVariationsNumber(p *PartitionRangeConfig) float64 { - var out float64 + out := float64(1) for _, col := range c { out *= col.Type.ValueVariationsNumber(p) } diff --git a/pkg/typedef/interfaces.go b/pkg/typedef/interfaces.go index ee05b42..d63e72d 100644 --- a/pkg/typedef/interfaces.go +++ b/pkg/typedef/interfaces.go @@ -44,7 +44,7 @@ func (l Types) LenValue() int { } func (l Types) ValueVariationsNumber(p *PartitionRangeConfig) float64 { - var out float64 + out := float64(1) for _, t := range l { out *= t.ValueVariationsNumber(p) } diff --git a/pkg/typedef/tuple.go b/pkg/typedef/tuple.go index 72c5c6b..d6e3420 100644 --- a/pkg/typedef/tuple.go +++ b/pkg/typedef/tuple.go @@ -101,7 +101,7 @@ func (t *TupleType) LenValue() int { // ValueVariationsNumber returns number of bytes generated value holds func (t *TupleType) ValueVariationsNumber(p *PartitionRangeConfig) float64 { - var out float64 + out := float64(1) for _, tp := range t.ValueTypes { out *= out * tp.ValueVariationsNumber(p) } diff --git a/pkg/typedef/udt.go b/pkg/typedef/udt.go index 6f4b7b4..d0f24da 100644 --- a/pkg/typedef/udt.go +++ b/pkg/typedef/udt.go @@ -96,7 +96,7 @@ func (t *UDTType) LenValue() int { // ValueVariationsNumber returns number of bytes generated value holds func (t *UDTType) ValueVariationsNumber(p *PartitionRangeConfig) float64 { - var out float64 + out := float64(1) for _, tp := range t.ValueTypes { out *= tp.ValueVariationsNumber(p) }