Skip to content

Commit 1a00f29

Browse files
committed
rowenc: use value encoding for LTree in Fingerprint
Release note: None
1 parent 2134917 commit 1a00f29

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

pkg/sql/catalog/colinfo/col_type_info.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,8 @@ func MustBeValueEncoded(semanticType *types.T) bool {
234234
// TODO(paulniziolek): LTreeFamily should be supported in keyside encoding.
235235
// Temporarily, we disallow it, until implemented.
236236
return true
237+
// NB: if you're adding a new type here, you probably also want to
238+
// include it into rowenc.mustUseValueEncodingForFingerprinting.
237239
}
238240
return false
239241
}

pkg/sql/rowenc/encoded_datum.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,9 @@ func (ed *EncDatum) Encode(
319319
}
320320
}
321321

322+
// TODO(yuzefovich): evaluate whether this method can call
323+
// colinfo.MustBeValueEncoded for most types. We need to be careful with
324+
// mixed-version clusters since Fingerprint is used by row-by-row hash routers.
322325
func mustUseValueEncodingForFingerprinting(t *types.T) bool {
323326
switch t.Family() {
324327
// Both TSQuery and TSVector types don't have key-encoding, so we must use
@@ -328,6 +331,9 @@ func mustUseValueEncodingForFingerprinting(t *types.T) bool {
328331
// behavior can result in incorrect results in mixed version clusters).
329332
case types.JsonFamily, types.TSQueryFamily, types.TSVectorFamily, types.PGVectorFamily:
330333
return true
334+
case types.LTreeFamily:
335+
// TODO(paulniziolek): remove this once key encoding is added.
336+
return true
331337
case types.ArrayFamily:
332338
// Note that at time of this writing we don't support arrays of JSON
333339
// (tracked via #23468) nor of TSQuery / TSVector / PGVector types (tracked by
@@ -348,7 +354,7 @@ func mustUseValueEncodingForFingerprinting(t *types.T) bool {
348354

349355
// Fingerprint appends a unique hash of ed to the given slice. If datums are intended
350356
// to be deduplicated or grouped with hashes, this function should be used
351-
// instead of encode. Additionally, Fingerprint has the property that if the
357+
// instead of Encode. Additionally, Fingerprint has the property that if the
352358
// fingerprints of a set of datums are appended together, the resulting
353359
// fingerprint will uniquely identify the set.
354360
// It takes an optional (can be nil) memory account that should be updated if

0 commit comments

Comments
 (0)