Skip to content

Commit 329bcb2

Browse files
committed
Bug fix: use ExtendedType serialization if present
1 parent 5d12b6a commit 329bcb2

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

sql/rowexec/agg.go

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,11 +257,18 @@ func groupingKey(
257257
}
258258
}
259259

260-
t, isStringType := expr.Type().(sql.StringType)
261-
if isStringType && v != nil {
262-
v, err = types.ConvertToString(ctx, v, t, nil)
260+
extendedType, isExtendedType := expr.Type().(types.ExtendedType)
261+
stringType, isStringType := expr.Type().(sql.StringType)
262+
263+
if isExtendedType && v != nil {
264+
bytes, err := extendedType.SerializeValue(ctx, v)
265+
if err == nil {
266+
_, err = fmt.Fprint(hash, string(bytes))
267+
}
268+
} else if isStringType && v != nil {
269+
v, err = types.ConvertToString(ctx, v, stringType, nil)
263270
if err == nil {
264-
err = t.Collation().WriteWeightString(hash, v.(string))
271+
err = stringType.Collation().WriteWeightString(hash, v.(string))
265272
}
266273
} else {
267274
_, err = fmt.Fprintf(hash, "%v", v)

0 commit comments

Comments
 (0)