-
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
evaluator, parser: support UTC_DATE() #1045
Conversation
@overvenus Thanks for your report! We will add more builtin functions. |
@shenli Hi, and yes, I have just added a new builtin function, it is a PR not issue. Maybe I should change title to Add UTC_DATE()? |
Sorry.... It is my mistake. |
@@ -316,6 +316,14 @@ func (s *testEvaluatorSuite) TestCurrentTime(c *C) { | |||
c.Assert(err, NotNil) | |||
} | |||
|
|||
func (s *testEvaluatorSuite) TestUTCDate(c *C) { |
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.
Can you add another case like:
mysql> select utc_date + 1;
+--------------+
| utc_date + 1 |
+--------------+
| 20160402 |
+--------------+
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.
ok, I will take a look, and maybe modification of current_date() is also needed.
@coocood @qiuyesuifeng PTAL |
@overvenus Any update for this PR? |
440446b
to
1e5ef42
Compare
@shenli @qiuyesuifeng PTAL |
LGTM |
@overvenus Thanks. |
see issue: pingcap#236.
1e5ef42
to
f70e1d4
Compare
Squashed. @shenli @qiuyesuifeng cc @c4pt0r |
@@ -390,6 +390,16 @@ func builtinCurrentTime(args []types.Datum, _ context.Context) (d types.Datum, e | |||
return convertToDuration(d, fsp) | |||
} | |||
|
|||
// See https://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html#function_utc-date | |||
func builtinUTCDate(args []types.Datum, _ context.Context) (d types.Datum, err error) { | |||
year, month, day := time.Now().Date() |
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.
Maybe we should change this to time.Now().UTC().Date()?
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.
Oops, I'm sorry, you are right, thank you for pointing out, I will fix it tomorrow.
PTAL |
LGTM |
see issue: #236.