Skip to content

Commit 8fbe44e

Browse files
author
James Cor
committed
fixing not equals
1 parent c4c7fea commit 8fbe44e

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

enginetest/queries/script_queries.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7831,6 +7831,12 @@ where
78317831
{123},
78327832
},
78337833
},
7834+
{
7835+
Query: "select * from t where i != (false or i);",
7836+
Expected: []sql.Row{
7837+
{123},
7838+
},
7839+
},
78347840
},
78357841
},
78367842
{

sql/analyzer/optimization_rules.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,11 +246,11 @@ func simplifyFilters(ctx *sql.Context, a *Analyzer, node sql.Node, scope *plan.S
246246
return e.RightChild, transform.NewTree, nil
247247
}
248248

249-
if isFalse(e.LeftChild) {
249+
if isFalse(e.LeftChild) && types.IsBoolean(e.RightChild.Type()) {
250250
return e.RightChild, transform.NewTree, nil
251251
}
252252

253-
if isFalse(e.RightChild) {
253+
if isFalse(e.RightChild) && types.IsBoolean(e.LeftChild.Type()) {
254254
return e.LeftChild, transform.NewTree, nil
255255
}
256256

0 commit comments

Comments
 (0)