{"action":"created","comment":{"url":"https://api.github.com/repos/tikv/tikv/pulls/comments/208872716","pull_request_review_id":144770587,"id":208872716,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwODg3MjcxNg==","diff_hunk":"@@ -37,6 +37,30 @@ impl ScalarFunc {\n         let i = try_opt!(self.children[0].eval_int(ctx, row));\n         Ok(Some(Cow::Owned(format!(\"{:b}\", i).into_bytes())))\n     }\n+\n+    pub fn left<'a, 'b: 'a>(\n+        &'b self,\n+        ctx: &mut EvalContext,\n+        row: &'a [Datum],\n+    ) -> Result<Option<Cow<'a, [u8]>>> {\n+        let s = try_opt!(self.children[0].eval_string(ctx, row));\n+        let i = try_opt!(self.children[1].eval_int(ctx, row));\n+        let s = str::from_utf8(&s)?;\n+        let slen = s.chars().count();\n+        let l: usize = if i < 0 {\n+            0\n+        } else if i as usize > slen {\n+            slen","path":"src/coprocessor/dag/expr/builtin_string.rs","position":26,"original_position":26,"commit_id":"a64ea160e4db5b0fb69f1aebcd16fd856e4ad41d","original_commit_id":"a64ea160e4db5b0fb69f1aebcd16fd856e4ad41d","user":{"login":"spongedu","id":4725158,"node_id":"MDQ6VXNlcjQ3MjUxNTg=","avatar_url":"https://avatars0.githubusercontent.com/u/4725158?v=4","gravatar_id":"","url":"https://api.github.com/users/spongedu","html_url":"https://github.com/spongedu","followers_url":"https://api.github.com/users/spongedu/followers","following_url":"https://api.github.com/users/spongedu/following{/other_user}","gists_url":"https://api.github.com/users/spongedu/gists{/gist_id}","starred_url":"https://api.github.com/users/spongedu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spongedu/subscriptions","organizations_url":"https://api.github.com/users/spongedu/orgs","repos_url":"https://api.github.com/users/spongedu/repos","events_url":"https://api.github.com/users/spongedu/events{/privacy}","received_events_url":"https://api.github.com/users/spongedu/received_events","type":"User","site_admin":false},"body":"Reasonable. I'll fix here ","created_at":"2018-08-09T10:00:08Z","updated_at":"2018-08-09T10:00:08Z","html_url":"https://github.com/tikv/tikv/pull/3413#discussion_r208872716","pull_request_url":"https://api.github.com/repos/tikv/tikv/pulls/3413","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/tikv/tikv/pulls/comments/208872716"},"html":{"href":"https://github.com/tikv/tikv/pull/3413#discussion_r208872716"},"pull_request":{"href":"https://api.github.com/repos/tikv/tikv/pulls/3413"}},"in_reply_to_id":208852879},"pull_request":{"url":"https://api.github.com/repos/tikv/tikv/pulls/3413","id":207062497,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA3MDYyNDk3","html_url":"https://github.com/tikv/tikv/pull/3413","diff_url":"https://github.com/tikv/tikv/pull/3413.diff","patch_url":"https://github.com/tikv/tikv/pull/3413.patch","issue_url":"https://api.github.com/repos/tikv/tikv/issues/3413","number":3413,"state":"open","locked":false,"title":"coprocessor/dag/expr: add some un-pushed builtin UDF(Left)","user":{"login":"spongedu","id":4725158,"node_id":"MDQ6VXNlcjQ3MjUxNTg=","avatar_url":"https://avatars0.githubusercontent.com/u/4725158?v=4","gravatar_id":"","url":"https://api.github.com/users/spongedu","html_url":"https://github.com/spongedu","followers_url":"https://api.github.com/users/spongedu/followers","following_url":"https://api.github.com/users/spongedu/following{/other_user}","gists_url":"https://api.github.com/users/spongedu/gists{/gist_id}","starred_url":"https://api.github.com/users/spongedu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spongedu/subscriptions","organizations_url":"https://api.github.com/users/spongedu/orgs","repos_url":"https://api.github.com/users/spongedu/repos","events_url":"https://api.github.com/users/spongedu/events{/privacy}","received_events_url":"https://api.github.com/users/spongedu/received_events","type":"User","site_admin":false},"body":"<!--\r\nThank you for contributing to TiKV! Please read TiKV's [CONTRIBUTING](https://github.com/pingcap/tikv/blob/master/CONTRIBUTING.md) document **BEFORE** filing this PR.\r\n-->\r\n\r\n## What have you changed? (mandatory)\r\n\r\nimplement builtin function: `Left`  in `coprocessor`.\r\nThis is for #3275\r\n\r\n## What are the type of the changes? (mandatory)\r\n\r\nImprovement\r\n\r\n## How has this PR been tested? (mandatory)\r\n\r\nunittest\r\n\r\n## Does this PR affect documentation (docs/docs-cn) update? (mandatory)\r\n\r\n## Does this PR affect tidb-ansible update? (mandatory)\r\n\r\n## Refer to a related PR or issue link (optional)\r\n\r\n#3275 \r\n\r\n## Benchmark result if necessary (optional)\r\n\r\n## Add a few positive/negative examples (optional)\r\n\r\n","created_at":"2018-08-08T16:16:09Z","updated_at":"2018-08-09T10:00:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8f4880e2782b8a706fd0929a72a8498425263c6b","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":526233180,"node_id":"MDU6TGFiZWw1MjYyMzMxODA=","url":"https://api.github.com/repos/tikv/tikv/labels/C:%20Copr","name":"C: Copr","color":"9df9d7","default":false},{"id":1013338313,"node_id":"MDU6TGFiZWwxMDEzMzM4MzEz","url":"https://api.github.com/repos/tikv/tikv/labels/T:%20Contributor","name":"T: Contributor","color":"1d76db","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/tikv/tikv/pulls/3413/commits","review_comments_url":"https://api.github.com/repos/tikv/tikv/pulls/3413/comments","review_comment_url":"https://api.github.com/repos/tikv/tikv/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tikv/tikv/issues/3413/comments","statuses_url":"https://api.github.com/repos/tikv/tikv/statuses/a64ea160e4db5b0fb69f1aebcd16fd856e4ad41d","head":{"label":"spongedu:dc_0808","ref":"dc_0808","sha":"a64ea160e4db5b0fb69f1aebcd16fd856e4ad41d","user":{"login":"spongedu","id":4725158,"node_id":"MDQ6VXNlcjQ3MjUxNTg=","avatar_url":"https://avatars0.githubusercontent.com/u/4725158?v=4","gravatar_id":"","url":"https://api.github.com/users/spongedu","html_url":"https://github.com/spongedu","followers_url":"https://api.github.com/users/spongedu/followers","following_url":"https://api.github.com/users/spongedu/following{/other_user}","gists_url":"https://api.github.com/users/spongedu/gists{/gist_id}","starred_url":"https://api.github.com/users/spongedu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spongedu/subscriptions","organizations_url":"https://api.github.com/users/spongedu/orgs","repos_url":"https://api.github.com/users/spongedu/repos","events_url":"https://api.github.com/users/spongedu/events{/privacy}","received_events_url":"https://api.github.com/users/spongedu/received_events","type":"User","site_admin":false},"repo":{"id":87509935,"node_id":"MDEwOlJlcG9zaXRvcnk4NzUwOTkzNQ==","name":"tikv","full_name":"spongedu/tikv","owner":{"login":"spongedu","id":4725158,"node_id":"MDQ6VXNlcjQ3MjUxNTg=","avatar_url":"https://avatars0.githubusercontent.com/u/4725158?v=4","gravatar_id":"","url":"https://api.github.com/users/spongedu","html_url":"https://github.com/spongedu","followers_url":"https://api.github.com/users/spongedu/followers","following_url":"https://api.github.com/users/spongedu/following{/other_user}","gists_url":"https://api.github.com/users/spongedu/gists{/gist_id}","starred_url":"https://api.github.com/users/spongedu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spongedu/subscriptions","organizations_url":"https://api.github.com/users/spongedu/orgs","repos_url":"https://api.github.com/users/spongedu/repos","events_url":"https://api.github.com/users/spongedu/events{/privacy}","received_events_url":"https://api.github.com/users/spongedu/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/spongedu/tikv","description":"Distributed transactional key value database powered by Rust and Raft","fork":true,"url":"https://api.github.com/repos/spongedu/tikv","forks_url":"https://api.github.com/repos/spongedu/tikv/forks","keys_url":"https://api.github.com/repos/spongedu/tikv/keys{/key_id}","collaborators_url":"https://api.github.com/repos/spongedu/tikv/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/spongedu/tikv/teams","hooks_url":"https://api.github.com/repos/spongedu/tikv/hooks","issue_events_url":"https://api.github.com/repos/spongedu/tikv/issues/events{/number}","events_url":"https://api.github.com/repos/spongedu/tikv/events","assignees_url":"https://api.github.com/repos/spongedu/tikv/assignees{/user}","branches_url":"https://api.github.com/repos/spongedu/tikv/branches{/branch}","tags_url":"https://api.github.com/repos/spongedu/tikv/tags","blobs_url":"https://api.github.com/repos/spongedu/tikv/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/spongedu/tikv/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/spongedu/tikv/git/refs{/sha}","trees_url":"https://api.github.com/repos/spongedu/tikv/git/trees{/sha}","statuses_url":"https://api.github.com/repos/spongedu/tikv/statuses/{sha}","languages_url":"https://api.github.com/repos/spongedu/tikv/languages","stargazers_url":"https://api.github.com/repos/spongedu/tikv/stargazers","contributors_url":"https://api.github.com/repos/spongedu/tikv/contributors","subscribers_url":"https://api.github.com/repos/spongedu/tikv/subscribers","subscription_url":"https://api.github.com/repos/spongedu/tikv/subscription","commits_url":"https://api.github.com/repos/spongedu/tikv/commits{/sha}","git_commits_url":"https://api.github.com/repos/spongedu/tikv/git/commits{/sha}","comments_url":"https://api.github.com/repos/spongedu/tikv/comments{/number}","issue_comment_url":"https://api.github.com/repos/spongedu/tikv/issues/comments{/number}","contents_url":"https://api.github.com/repos/spongedu/tikv/contents/{+path}","compare_url":"https://api.github.com/repos/spongedu/tikv/compare/{base}...{head}","merges_url":"https://api.github.com/repos/spongedu/tikv/merges","archive_url":"https://api.github.com/repos/spongedu/tikv/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/spongedu/tikv/downloads","issues_url":"https://api.github.com/repos/spongedu/tikv/issues{/number}","pulls_url":"https://api.github.com/repos/spongedu/tikv/pulls{/number}","milestones_url":"https://api.github.com/repos/spongedu/tikv/milestones{/number}","notifications_url":"https://api.github.com/repos/spongedu/tikv/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/spongedu/tikv/labels{/name}","releases_url":"https://api.github.com/repos/spongedu/tikv/releases{/id}","deployments_url":"https://api.github.com/repos/spongedu/tikv/deployments","created_at":"2017-04-07T05:56:03Z","updated_at":"2018-08-07T00:45:10Z","pushed_at":"2018-08-09T03:39:20Z","git_url":"git://github.com/spongedu/tikv.git","ssh_url":"git@github.com:spongedu/tikv.git","clone_url":"https://github.com/spongedu/tikv.git","svn_url":"https://github.com/spongedu/tikv","homepage":"","size":15334,"stargazers_count":0,"watchers_count":0,"language":"Rust","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"tikv:master","ref":"master","sha":"96022a982b6b34d9cd8b690cf6d4b0b85ffae247","user":{"login":"tikv","id":41004122,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQxMDA0MTIy","avatar_url":"https://avatars2.githubusercontent.com/u/41004122?v=4","gravatar_id":"","url":"https://api.github.com/users/tikv","html_url":"https://github.com/tikv","followers_url":"https://api.github.com/users/tikv/followers","following_url":"https://api.github.com/users/tikv/following{/other_user}","gists_url":"https://api.github.com/users/tikv/gists{/gist_id}","starred_url":"https://api.github.com/users/tikv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tikv/subscriptions","organizations_url":"https://api.github.com/users/tikv/orgs","repos_url":"https://api.github.com/users/tikv/repos","events_url":"https://api.github.com/users/tikv/events{/privacy}","received_events_url":"https://api.github.com/users/tikv/received_events","type":"Organization","site_admin":false},"repo":{"id":48833910,"node_id":"MDEwOlJlcG9zaXRvcnk0ODgzMzkxMA==","name":"tikv","full_name":"tikv/tikv","owner":{"login":"tikv","id":41004122,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQxMDA0MTIy","avatar_url":"https://avatars2.githubusercontent.com/u/41004122?v=4","gravatar_id":"","url":"https://api.github.com/users/tikv","html_url":"https://github.com/tikv","followers_url":"https://api.github.com/users/tikv/followers","following_url":"https://api.github.com/users/tikv/following{/other_user}","gists_url":"https://api.github.com/users/tikv/gists{/gist_id}","starred_url":"https://api.github.com/users/tikv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tikv/subscriptions","organizations_url":"https://api.github.com/users/tikv/orgs","repos_url":"https://api.github.com/users/tikv/repos","events_url":"https://api.github.com/users/tikv/events{/privacy}","received_events_url":"https://api.github.com/users/tikv/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/tikv/tikv","description":"Distributed transactional key value database powered by Rust and Raft","fork":false,"url":"https://api.github.com/repos/tikv/tikv","forks_url":"https://api.github.com/repos/tikv/tikv/forks","keys_url":"https://api.github.com/repos/tikv/tikv/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tikv/tikv/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tikv/tikv/teams","hooks_url":"https://api.github.com/repos/tikv/tikv/hooks","issue_events_url":"https://api.github.com/repos/tikv/tikv/issues/events{/number}","events_url":"https://api.github.com/repos/tikv/tikv/events","assignees_url":"https://api.github.com/repos/tikv/tikv/assignees{/user}","branches_url":"https://api.github.com/repos/tikv/tikv/branches{/branch}","tags_url":"https://api.github.com/repos/tikv/tikv/tags","blobs_url":"https://api.github.com/repos/tikv/tikv/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tikv/tikv/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tikv/tikv/git/refs{/sha}","trees_url":"https://api.github.com/repos/tikv/tikv/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tikv/tikv/statuses/{sha}","languages_url":"https://api.github.com/repos/tikv/tikv/languages","stargazers_url":"https://api.github.com/repos/tikv/tikv/stargazers","contributors_url":"https://api.github.com/repos/tikv/tikv/contributors","subscribers_url":"https://api.github.com/repos/tikv/tikv/subscribers","subscription_url":"https://api.github.com/repos/tikv/tikv/subscription","commits_url":"https://api.github.com/repos/tikv/tikv/commits{/sha}","git_commits_url":"https://api.github.com/repos/tikv/tikv/git/commits{/sha}","comments_url":"https://api.github.com/repos/tikv/tikv/comments{/number}","issue_comment_url":"https://api.github.com/repos/tikv/tikv/issues/comments{/number}","contents_url":"https://api.github.com/repos/tikv/tikv/contents/{+path}","compare_url":"https://api.github.com/repos/tikv/tikv/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tikv/tikv/merges","archive_url":"https://api.github.com/repos/tikv/tikv/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tikv/tikv/downloads","issues_url":"https://api.github.com/repos/tikv/tikv/issues{/number}","pulls_url":"https://api.github.com/repos/tikv/tikv/pulls{/number}","milestones_url":"https://api.github.com/repos/tikv/tikv/milestones{/number}","notifications_url":"https://api.github.com/repos/tikv/tikv/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tikv/tikv/labels{/name}","releases_url":"https://api.github.com/repos/tikv/tikv/releases{/id}","deployments_url":"https://api.github.com/repos/tikv/tikv/deployments","created_at":"2015-12-31T04:51:32Z","updated_at":"2018-08-09T09:24:43Z","pushed_at":"2018-08-09T09:34:03Z","git_url":"git://github.com/tikv/tikv.git","ssh_url":"git@github.com:tikv/tikv.git","clone_url":"https://github.com/tikv/tikv.git","svn_url":"https://github.com/tikv/tikv","homepage":"https://pingcap.com","size":14940,"stargazers_count":3466,"watchers_count":3466,"language":"Rust","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":464,"mirror_url":null,"archived":false,"open_issues_count":246,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":464,"open_issues":246,"watchers":3466,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tikv/tikv/pulls/3413"},"html":{"href":"https://github.com/tikv/tikv/pull/3413"},"issue":{"href":"https://api.github.com/repos/tikv/tikv/issues/3413"},"comments":{"href":"https://api.github.com/repos/tikv/tikv/issues/3413/comments"},"review_comments":{"href":"https://api.github.com/repos/tikv/tikv/pulls/3413/comments"},"review_comment":{"href":"https://api.github.com/repos/tikv/tikv/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tikv/tikv/pulls/3413/commits"},"statuses":{"href":"https://api.github.com/repos/tikv/tikv/statuses/a64ea160e4db5b0fb69f1aebcd16fd856e4ad41d"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"spongedu"}}