Skip to content

Commit f5b659e

Browse files
committed
Disable the short circuiting of comparing wrapped values until we confirm it has a real performance benefit, and not a performance penalty.
1 parent 1867e61 commit f5b659e

File tree

2 files changed

+1
-20
lines changed

2 files changed

+1
-20
lines changed

memory/wrapper_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ func TestWrapperCompare(t *testing.T) {
176176

177177
// TestWrapperCompare tests that a wrapped value can be used in comparisons without being unwrapped.
178178
func TestWrapperSelfCompare(t *testing.T) {
179+
t.Skip("This is not currently enabled because it may have performance implications.")
179180
db := memory.NewDatabase("db")
180181
pro := memory.NewDBProvider(db)
181182
ctx := newContext(pro)

sql/expression/comparison.go

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -127,26 +127,6 @@ func (c *comparison) Compare(ctx *sql.Context, row sql.Row) (int, error) {
127127
return 0, ErrNilOperand.New()
128128
}
129129

130-
if wrapperLeft, isWrapperLeft := left.(sql.AnyWrapper); isWrapperLeft {
131-
cmp, isComparable, err := wrapperLeft.Compare(ctx, right)
132-
if err != nil {
133-
return 0, err
134-
}
135-
if isComparable {
136-
return cmp, nil
137-
}
138-
}
139-
140-
if wrapperRight, isWrapperRight := right.(sql.AnyWrapper); isWrapperRight {
141-
cmp, isComparable, err := wrapperRight.Compare(ctx, left)
142-
if err != nil {
143-
return 0, err
144-
}
145-
if isComparable {
146-
return -cmp, nil
147-
}
148-
}
149-
150130
left, err = sql.UnwrapAny(ctx, left)
151131
if err != nil {
152132
return 0, err

0 commit comments

Comments
 (0)