Skip to content

Commit f07103b

Browse files
author
James Cor
committed
special case for extended type
1 parent 6674b3c commit f07103b

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

sql/rowexec/agg.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ package rowexec
1616

1717
import (
1818
"errors"
19+
"github.com/dolthub/go-mysql-server/sql/types"
1920
"io"
2021

2122
"github.com/dolthub/go-mysql-server/sql"
@@ -243,8 +244,19 @@ func groupingKey(ctx *sql.Context, exprs []sql.Expression, row sql.Row) (uint64,
243244
if err != nil {
244245
return 0, err
245246
}
247+
248+
// TODO: this should be moved into hash.HashOf
249+
typ := expr.Type()
250+
if extTyp, isExtTyp := typ.(types.ExtendedType); isExtTyp {
251+
val, vErr := extTyp.SerializeValue(ctx, v)
252+
if vErr != nil {
253+
return 0, vErr
254+
}
255+
v = string(val)
256+
}
257+
246258
keyRow[i] = v
247-
keySch[i] = &sql.Column{Type: expr.Type()}
259+
keySch[i] = &sql.Column{Type: typ}
248260
}
249261
return hash.HashOf(ctx, keySch, keyRow)
250262
}

0 commit comments

Comments
 (0)