Skip to content

Commit ad55299

Browse files
committed
pr feedback: swapping in types.GetCompareType()
1 parent 5296424 commit ad55299

1 file changed

Lines changed: 1 addition & 13 deletions

File tree

sql/expression/function/aggregation/window_framer.go

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -458,19 +458,7 @@ func findInclusionBoundary(ctx *sql.Context, pos, searchStart, partitionEnd int,
458458
return 0, err
459459
}
460460

461-
// [expr]'s type is normally sufficient to compare [res] and [cur], since [cur] is
462-
// usually just [expr] shifted by a same-typed offset (e.g. int+int, date+interval).
463-
// SET and ENUM order-by columns are the exception: their arithmetic offset (e.g.
464-
// `set_col + 1`) can legitimately land outside the column's valid domain, and
465-
// SetType/EnumType's Compare rejects out-of-domain values since it's also used to
466-
// validate storage. Range framing only needs numeric ordering here, so fall back to
467-
// comparing using [inclusion]'s (numeric) type instead, mirroring the same Set/Enum
468-
// fallback castLeftAndRight uses in expression/comparison.go.
469-
compareType := expr.Type(ctx)
470-
if types.IsSet(compareType) || types.IsEnum(compareType) {
471-
compareType = inclusion.Type(ctx)
472-
}
473-
461+
compareType := types.GetCompareType(expr.Type(ctx), inclusion.Type(ctx))
474462
i := searchStart
475463
cmp := unknown
476464
for ; cmp < int(stopCond); i++ {

0 commit comments

Comments
 (0)