{"action":"created","issue":{"url":"https://api.github.com/repos/pingcap/tidb/issues/6981","repository_url":"https://api.github.com/repos/pingcap/tidb","labels_url":"https://api.github.com/repos/pingcap/tidb/issues/6981/labels{/name}","comments_url":"https://api.github.com/repos/pingcap/tidb/issues/6981/comments","events_url":"https://api.github.com/repos/pingcap/tidb/issues/6981/events","html_url":"https://github.com/pingcap/tidb/issues/6981","id":338169898,"node_id":"MDU6SXNzdWUzMzgxNjk4OTg=","number":6981,"title":"unix_timestamp return worng result when input with fractional digits","user":{"login":"lysu","id":528332,"node_id":"MDQ6VXNlcjUyODMzMg==","avatar_url":"https://avatars3.githubusercontent.com/u/528332?v=4","gravatar_id":"","url":"https://api.github.com/users/lysu","html_url":"https://github.com/lysu","followers_url":"https://api.github.com/users/lysu/followers","following_url":"https://api.github.com/users/lysu/following{/other_user}","gists_url":"https://api.github.com/users/lysu/gists{/gist_id}","starred_url":"https://api.github.com/users/lysu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lysu/subscriptions","organizations_url":"https://api.github.com/users/lysu/orgs","repos_url":"https://api.github.com/users/lysu/repos","events_url":"https://api.github.com/users/lysu/events{/privacy}","received_events_url":"https://api.github.com/users/lysu/received_events","type":"User","site_admin":false},"labels":[{"id":256872089,"node_id":"MDU6TGFiZWwyNTY4NzIwODk=","url":"https://api.github.com/repos/pingcap/tidb/labels/help%20wanted","name":"help wanted","color":"159818","default":true},{"id":256872086,"node_id":"MDU6TGFiZWwyNTY4NzIwODY=","url":"https://api.github.com/repos/pingcap/tidb/labels/type/bug","name":"type/bug","color":"fc2929","default":false},{"id":541179553,"node_id":"MDU6TGFiZWw1NDExNzk1NTM=","url":"https://api.github.com/repos/pingcap/tidb/labels/type/compatibility","name":"type/compatibility","color":"e99695","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-07-04T08:02:25Z","updated_at":"2018-09-23T12:49:50Z","closed_at":null,"author_association":"MEMBER","body":"1. What did you do?\r\nIf possible, provide a recipe for reproducing the error.\r\n\r\n```\r\nmysql -P3306 -h127.0.0.1 -uroot -proot --column-type-info test;\r\n\r\nmysql> select unix_timestamp('2011:01:01.001');\r\n```\r\n\r\n2. What did you expect to see?\r\n\r\n```\r\nField   1:  `unix_timestamp('2011:01:01.001')`\r\nCatalog:    `def`\r\nDatabase:   ``\r\nTable:      ``\r\nOrg_table:  ``\r\nType:       LONGLONG\r\nCollation:  binary (63)\r\nLength:     11\r\nMax_length: 10\r\nDecimals:   0\r\nFlags:      NOT_NULL BINARY NUM \r\n\r\n+----------------------------------+\r\n| unix_timestamp('2011:01:01.001') |\r\n+----------------------------------+\r\n|                       1293814800 |\r\n+----------------------------------+\r\n1 row in set (0.00 sec)\r\n```\r\n\r\n3. What did you see instead?\r\n\r\n```\r\nField   1:  `unix_timestamp('2011:01:01.001')`\r\nCatalog:    `def`\r\nDatabase:   ``\r\nTable:      ``\r\nOrg_table:  ``\r\nType:       NEWDECIMAL\r\nCollation:  binary (63)\r\nLength:     17\r\nMax_length: 14\r\nDecimals:   3\r\nFlags:      BINARY NUM \r\n\r\n\r\n+----------------------------------+\r\n| unix_timestamp('2011:01:01.001') |\r\n+----------------------------------+\r\n|                   1293811200.000 |\r\n+----------------------------------+\r\n1 row in set (0.00 sec)\r\n```\r\n\r\n4. What version of TiDB are you using (`tidb-server -V` or run `select tidb_version();` on TiDB)?\r\n\r\n```\r\nRelease Version: v2.1.0-beta-11-g1f6e12cc5\r\nGit Commit Hash: 1f6e12cc55e534bf514eef212f1091a91b8592c9\r\nGit Branch: HEAD\r\nUTC Build Time: 2018-07-04 06:31:26\r\nGoVersion: go version go1.10.1 linux/amd64\r\nRace Enabled: false\r\nTiKV Min Version: 2.1.0-alpha.1-ff3dd160846b7d1aed9079c389fc188f7f5ea13e\r\n\r\n```"},"comment":{"url":"https://api.github.com/repos/pingcap/tidb/issues/comments/423814276","html_url":"https://github.com/pingcap/tidb/issues/6981#issuecomment-423814276","issue_url":"https://api.github.com/repos/pingcap/tidb/issues/6981","id":423814276,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMzgxNDI3Ng==","user":{"login":"AndrewDi","id":7589147,"node_id":"MDQ6VXNlcjc1ODkxNDc=","avatar_url":"https://avatars1.githubusercontent.com/u/7589147?v=4","gravatar_id":"","url":"https://api.github.com/users/AndrewDi","html_url":"https://github.com/AndrewDi","followers_url":"https://api.github.com/users/AndrewDi/followers","following_url":"https://api.github.com/users/AndrewDi/following{/other_user}","gists_url":"https://api.github.com/users/AndrewDi/gists{/gist_id}","starred_url":"https://api.github.com/users/AndrewDi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndrewDi/subscriptions","organizations_url":"https://api.github.com/users/AndrewDi/orgs","repos_url":"https://api.github.com/users/AndrewDi/repos","events_url":"https://api.github.com/users/AndrewDi/events{/privacy}","received_events_url":"https://api.github.com/users/AndrewDi/received_events","type":"User","site_admin":false},"created_at":"2018-09-23T12:49:50Z","updated_at":"2018-09-23T12:49:50Z","author_association":"NONE","body":"I found in the design, tidb unix_timestamp keep decimal part, is that work as design?\r\n[https://github.com/pingcap/tidb/blob/29441950a3af631ea99eb9de4e3b80a624865170/expression/builtin_time_test.go#L1584](url)\r\n```\r\n{0, types.NewStringDatum(\"2015-11-13 10:20:19.012\"), types.KindMysqlDecimal, \"1447410019.012\"},\r\n```"}}
{"actor":{"display_login":"AndrewDi"}}