-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
expression, plan: rewrite builtin function: IS TRUE && IS FALSE #4086
Conversation
|
||
isTrue, err := isTrueSig.eval(nil) | ||
c.Assert(err, IsNil) | ||
c.Assert(isTrue, testutil.DatumEquals, types.NewDatum(tc.isTrue)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/ NewDatum/ NewIntDatum(int64(tc.isTrue))
|
||
isFalse, err := isFalseSig.eval(nil) | ||
c.Assert(err, IsNil) | ||
c.Assert(isFalse, testutil.DatumEquals, types.NewDatum(tc.isFalse)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
expression/builtin_op_test.go
Outdated
}{ | ||
{ | ||
args: []interface{}{int64(-12)}, | ||
isTrue: int64(1), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove int64()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@XuHuaiyu updated, PTAL |
expression/builtin_op.go
Outdated
|
||
var sig builtinFunc | ||
switch { | ||
case c.op == opcode.IsTruth && argTp == tpReal: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
two switch may be more explict?
siwtch c.op{
switch argtP{
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need, it makes code complex
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
to #4080