Skip to content

Commit

Permalink
think I need to fix upstream to not erase scale parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
serprex committed Dec 10, 2024
1 parent 473f771 commit a3a3321
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions flow/e2e/clickhouse/clickhouse.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,23 +130,24 @@ func rawToBigInt(v []byte, signed bool) *big.Int {
func decimalRow(col chproto.ColResult, i int) decimal.Decimal {
typ := string(col.Type())
lparam := strings.LastIndex(typ, "(")
if lparam == -1 {
panic("no ( in " + typ)
}
params := typ[lparam+1:]
rparam := strings.Index(params, ")")
if rparam == -1 {
panic("no ) in params " + params + " of " + typ)
}
params = typ[:rparam]
_, scaleStr, ok := strings.Cut(params, ",")
if !ok {
panic("no , in params " + params + " of " + typ)
}
scaleStr = strings.TrimSpace(scaleStr)
scale, err := strconv.Atoi(scaleStr)
if err != nil {
panic("failed to parse scale " + scaleStr + ": " + err.Error())
scale := 0
if lparam != -1 {
params := typ[lparam+1:]
rparam := strings.Index(params, ")")
if rparam == -1 {
panic("no ) in params " + params + " of " + typ)
}
params = typ[:rparam]
_, scaleStr, ok := strings.Cut(params, ",")
if !ok {
panic("no , in params " + params + " of " + typ)
}
scaleStr = strings.TrimSpace(scaleStr)
var err error
scale, err = strconv.Atoi(scaleStr)
if err != nil {
panic("failed to parse scale " + scaleStr + ": " + err.Error())
}
}

var value decimal.Decimal
Expand Down

0 comments on commit a3a3321

Please sign in to comment.