-
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: add builtin function tidb_parse_tso #8385
Conversation
Hi contributor, thanks for your PR. This patch needs to be approved by someone of admins. They should reply with "/ok-to-test" to accept this PR for running test automatically. |
/ok-to-test |
Thanks for your contribution, @yu34po ! |
/run-all-tests |
// evalTime evals a builtinTsoSig. | ||
func (b *builtinTsoSig) evalTime(row chunk.Row) (types.Time, bool, error) { | ||
arg, isNull, err := b.args[0].EvalInt(b.ctx, row) | ||
if isNull || err != nil || arg <= 0 { |
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.
Why should we consider the case of isNull == true
as an error ?
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.
function must accept a parameter
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.
got it.
In the statement: "update t1,t2 set t1.id = t2.id" TiDB should check update privilege for t1 and select privilege for t2, Fix a bug that it checks update privilege for both t1 and t2
@yu34po The PR includes vender files, which should not be. Would you check whether or not you set the environment variable, |
@yu34po Would you also add the test for SQL statements having |
expression/builtin.go
Outdated
@@ -413,6 +413,7 @@ var funcs = map[string]functionClass{ | |||
ast.Year: &yearFunctionClass{baseFunctionClass{ast.Year, 1, 1}}, | |||
ast.YearWeek: &yearWeekFunctionClass{baseFunctionClass{ast.YearWeek, 1, 2}}, | |||
ast.LastDay: &lastDayFunctionClass{baseFunctionClass{ast.LastDay, 1, 1}}, | |||
ast.Tso: &tsoFunctionClass{baseFunctionClass{ast.Tso, 1, 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.
We'd better change ast.Tso to ast.TidbParseTso
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.
ast.Tso already merged in parser master
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.
We can push another PR to change the name
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
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.
I think we'd better:
- change ast.Tso to ast.TiDBParseTso
- change tsoXXX to tidbParseTsoXXX
LGTM |
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.
Please address the comment.
Rest LGTM.
Thanks for your contribution.
go.mod
Outdated
@@ -49,3 +50,5 @@ require ( | |||
gopkg.in/natefinch/lumberjack.v2 v2.0.0 | |||
sourcegraph.com/sourcegraph/appdash v0.0.0-20180531100431-4c381bd170b4 | |||
) | |||
|
|||
replace github.com/pingcap/parser => github.com/yu34po/parser v0.0.0-20181123030610-1d6c3c585f2d |
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.
please update go.mod
to use the latest pingcap/parser
.
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.
please update go.mod
@yu34po pingcap/parser#50 has been merged, you can update |
go.mod
Outdated
@@ -41,6 +41,7 @@ require ( | |||
github.com/shirou/gopsutil v2.18.10+incompatible | |||
github.com/sirupsen/logrus v1.2.0 | |||
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72 | |||
github.com/tiancaiamao/appdash v0.0.0-20181126055449-889f96f722a2 |
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.
why add this?
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.
I don't know how this happened.
same as master expect parser version
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.
It disappeared after merging the master branch..
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
/run-all-tests |
What problem does this PR solve?
#8384
What is changed and how it works?
add time builtin function tso
Check List
Code changes
Side effects
Related changes
This change is