ClickHouse/ch-go

Or(v T) of Nullable[T] (in proto package) works improperly

edgro opened this issue · 1 comments

edgro commented

Describe the bug

Or(v T) of Nullable[T] (in proto package) works improperly

Steps to reproduce

  1. Use Or(v T) in parsing results of query
  2. If underlying value is set, Or() will anyway return default value (v T), due to this bug

Expected behaviour

Should return default value when underlying is not Set

Code example

Looks like this:

func (n Nullable[T]) Or(v T) T {
	if n.Set {
		return v
	}
	return n.Value
}

Should be:

func (n Nullable[T]) Or(v T) T {
	if n.Set {
		return n.Value
	}
	return v
}

Error log

Configuration

Environment

  • Client version: 0.50, 0.61
  • Language version: any
  • OS: any
ernado commented

v0.61.2