{"action":"created","comment":{"url":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments/205542383","pull_request_review_id":140833888,"id":205542383,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwNTU0MjM4Mw==","diff_hunk":"@@ -0,0 +1,98 @@\n+/*\n+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one\n+ * or more contributor license agreements. Licensed under the Elastic License;\n+ * you may not use this file except in compliance with the Elastic License.\n+ */\n+package org.elasticsearch.xpack.sql.expression.function.scalar.string;\n+\n+import org.elasticsearch.xpack.sql.expression.Expression;\n+import org.elasticsearch.xpack.sql.expression.FieldAttribute;\n+import org.elasticsearch.xpack.sql.expression.function.scalar.BinaryScalarFunction;\n+import org.elasticsearch.xpack.sql.expression.function.scalar.script.ScriptTemplate;\n+import org.elasticsearch.xpack.sql.tree.Location;\n+import org.elasticsearch.xpack.sql.type.DataType;\n+import org.elasticsearch.xpack.sql.util.StringUtils;\n+\n+import java.util.Locale;\n+import java.util.Objects;\n+import java.util.function.BiFunction;\n+\n+import static java.lang.String.format;\n+import static org.elasticsearch.xpack.sql.expression.function.scalar.script.ParamsBuilder.paramsBuilder;\n+import static org.elasticsearch.xpack.sql.expression.function.scalar.script.ScriptTemplate.formatTemplate;\n+\n+/**\n+ * A binary string function that abstracts away the second parameter of a binary string function and its result.\n+ * This class is the base for binary functions that have the first parameter a string, the second parameter a number\n+ * or a string and the result can be a string or a number.","path":"x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/function/scalar/string/BinaryStringFunction.java","position":27,"original_position":27,"commit_id":"3a7e81b904a7e4b9f14561d4c9d45aecbc224477","original_commit_id":"3a7e81b904a7e4b9f14561d4c9d45aecbc224477","user":{"login":"nik9000","id":215970,"node_id":"MDQ6VXNlcjIxNTk3MA==","avatar_url":"https://avatars2.githubusercontent.com/u/215970?v=4","gravatar_id":"","url":"https://api.github.com/users/nik9000","html_url":"https://github.com/nik9000","followers_url":"https://api.github.com/users/nik9000/followers","following_url":"https://api.github.com/users/nik9000/following{/other_user}","gists_url":"https://api.github.com/users/nik9000/gists{/gist_id}","starred_url":"https://api.github.com/users/nik9000/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nik9000/subscriptions","organizations_url":"https://api.github.com/users/nik9000/orgs","repos_url":"https://api.github.com/users/nik9000/repos","events_url":"https://api.github.com/users/nik9000/events{/privacy}","received_events_url":"https://api.github.com/users/nik9000/received_events","type":"User","site_admin":false},"body":"The javadoc says the result can be a string or a number but the `dataType` function below is always a `KEYWORD` which makes me think it is always a string.","created_at":"2018-07-26T17:37:41Z","updated_at":"2018-07-26T18:01:57Z","html_url":"https://github.com/elastic/elasticsearch/pull/32356#discussion_r205542383","pull_request_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/32356","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments/205542383"},"html":{"href":"https://github.com/elastic/elasticsearch/pull/32356#discussion_r205542383"},"pull_request":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/32356"}}},"pull_request":{"url":"https://api.github.com/repos/elastic/elasticsearch/pulls/32356","id":203778635,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAzNzc4NjM1","html_url":"https://github.com/elastic/elasticsearch/pull/32356","diff_url":"https://github.com/elastic/elasticsearch/pull/32356.diff","patch_url":"https://github.com/elastic/elasticsearch/pull/32356.patch","issue_url":"https://api.github.com/repos/elastic/elasticsearch/issues/32356","number":32356,"state":"open","locked":false,"title":"SQL: Added support for string manipulating functions with more than one parameter","user":{"login":"astefan","id":893749,"node_id":"MDQ6VXNlcjg5Mzc0OQ==","avatar_url":"https://avatars2.githubusercontent.com/u/893749?v=4","gravatar_id":"","url":"https://api.github.com/users/astefan","html_url":"https://github.com/astefan","followers_url":"https://api.github.com/users/astefan/followers","following_url":"https://api.github.com/users/astefan/following{/other_user}","gists_url":"https://api.github.com/users/astefan/gists{/gist_id}","starred_url":"https://api.github.com/users/astefan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/astefan/subscriptions","organizations_url":"https://api.github.com/users/astefan/orgs","repos_url":"https://api.github.com/users/astefan/repos","events_url":"https://api.github.com/users/astefan/events{/privacy}","received_events_url":"https://api.github.com/users/astefan/received_events","type":"User","site_admin":false},"body":"This PR is the second part fix for https://github.com/elastic/elasticsearch/issues/31604. It covers all the functions with more than one parameter: CONCAT, LEFT, RIGHT, REPEAT, POSITION, LOCATE, REPLACE, SUBSTRING, INSERT.","created_at":"2018-07-25T09:40:42Z","updated_at":"2018-07-26T18:01:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"be0c94c81465be94df0e28818c8db92d284160e5","assignee":null,"assignees":[],"requested_reviewers":[{"login":"costin","id":76245,"node_id":"MDQ6VXNlcjc2MjQ1","avatar_url":"https://avatars3.githubusercontent.com/u/76245?v=4","gravatar_id":"","url":"https://api.github.com/users/costin","html_url":"https://github.com/costin","followers_url":"https://api.github.com/users/costin/followers","following_url":"https://api.github.com/users/costin/following{/other_user}","gists_url":"https://api.github.com/users/costin/gists{/gist_id}","starred_url":"https://api.github.com/users/costin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/costin/subscriptions","organizations_url":"https://api.github.com/users/costin/orgs","repos_url":"https://api.github.com/users/costin/repos","events_url":"https://api.github.com/users/costin/events{/privacy}","received_events_url":"https://api.github.com/users/costin/received_events","type":"User","site_admin":false},{"login":"pcsanwald","id":163306,"node_id":"MDQ6VXNlcjE2MzMwNg==","avatar_url":"https://avatars1.githubusercontent.com/u/163306?v=4","gravatar_id":"","url":"https://api.github.com/users/pcsanwald","html_url":"https://github.com/pcsanwald","followers_url":"https://api.github.com/users/pcsanwald/followers","following_url":"https://api.github.com/users/pcsanwald/following{/other_user}","gists_url":"https://api.github.com/users/pcsanwald/gists{/gist_id}","starred_url":"https://api.github.com/users/pcsanwald/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pcsanwald/subscriptions","organizations_url":"https://api.github.com/users/pcsanwald/orgs","repos_url":"https://api.github.com/users/pcsanwald/repos","events_url":"https://api.github.com/users/pcsanwald/events{/privacy}","received_events_url":"https://api.github.com/users/pcsanwald/received_events","type":"User","site_admin":false},{"login":"imotov","id":655851,"node_id":"MDQ6VXNlcjY1NTg1MQ==","avatar_url":"https://avatars3.githubusercontent.com/u/655851?v=4","gravatar_id":"","url":"https://api.github.com/users/imotov","html_url":"https://github.com/imotov","followers_url":"https://api.github.com/users/imotov/followers","following_url":"https://api.github.com/users/imotov/following{/other_user}","gists_url":"https://api.github.com/users/imotov/gists{/gist_id}","starred_url":"https://api.github.com/users/imotov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/imotov/subscriptions","organizations_url":"https://api.github.com/users/imotov/orgs","repos_url":"https://api.github.com/users/imotov/repos","events_url":"https://api.github.com/users/imotov/events{/privacy}","received_events_url":"https://api.github.com/users/imotov/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":912794284,"node_id":"MDU6TGFiZWw5MTI3OTQyODQ=","url":"https://api.github.com/repos/elastic/elasticsearch/labels/:Search/SQL","name":":Search/SQL","color":"0e8a16","default":false},{"id":23174,"node_id":"MDU6TGFiZWwyMzE3NA==","url":"https://api.github.com/repos/elastic/elasticsearch/labels/%3Eenhancement","name":">enhancement","color":"4a4ea8","default":false},{"id":912911731,"node_id":"MDU6TGFiZWw5MTI5MTE3MzE=","url":"https://api.github.com/repos/elastic/elasticsearch/labels/v6.4.0","name":"v6.4.0","color":"DDDDDD","default":false},{"id":484855464,"node_id":"MDU6TGFiZWw0ODQ4NTU0NjQ=","url":"https://api.github.com/repos/elastic/elasticsearch/labels/v7.0.0","name":"v7.0.0","color":"dddddd","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/32356/commits","review_comments_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/32356/comments","review_comment_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments{/number}","comments_url":"https://api.github.com/repos/elastic/elasticsearch/issues/32356/comments","statuses_url":"https://api.github.com/repos/elastic/elasticsearch/statuses/3a7e81b904a7e4b9f14561d4c9d45aecbc224477","head":{"label":"astefan:31604_2nd_part","ref":"31604_2nd_part","sha":"3a7e81b904a7e4b9f14561d4c9d45aecbc224477","user":{"login":"astefan","id":893749,"node_id":"MDQ6VXNlcjg5Mzc0OQ==","avatar_url":"https://avatars2.githubusercontent.com/u/893749?v=4","gravatar_id":"","url":"https://api.github.com/users/astefan","html_url":"https://github.com/astefan","followers_url":"https://api.github.com/users/astefan/followers","following_url":"https://api.github.com/users/astefan/following{/other_user}","gists_url":"https://api.github.com/users/astefan/gists{/gist_id}","starred_url":"https://api.github.com/users/astefan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/astefan/subscriptions","organizations_url":"https://api.github.com/users/astefan/orgs","repos_url":"https://api.github.com/users/astefan/repos","events_url":"https://api.github.com/users/astefan/events{/privacy}","received_events_url":"https://api.github.com/users/astefan/received_events","type":"User","site_admin":false},"repo":{"id":133608956,"node_id":"MDEwOlJlcG9zaXRvcnkxMzM2MDg5NTY=","name":"elasticsearch","full_name":"astefan/elasticsearch","owner":{"login":"astefan","id":893749,"node_id":"MDQ6VXNlcjg5Mzc0OQ==","avatar_url":"https://avatars2.githubusercontent.com/u/893749?v=4","gravatar_id":"","url":"https://api.github.com/users/astefan","html_url":"https://github.com/astefan","followers_url":"https://api.github.com/users/astefan/followers","following_url":"https://api.github.com/users/astefan/following{/other_user}","gists_url":"https://api.github.com/users/astefan/gists{/gist_id}","starred_url":"https://api.github.com/users/astefan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/astefan/subscriptions","organizations_url":"https://api.github.com/users/astefan/orgs","repos_url":"https://api.github.com/users/astefan/repos","events_url":"https://api.github.com/users/astefan/events{/privacy}","received_events_url":"https://api.github.com/users/astefan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/astefan/elasticsearch","description":"Open Source, Distributed, RESTful Search Engine","fork":true,"url":"https://api.github.com/repos/astefan/elasticsearch","forks_url":"https://api.github.com/repos/astefan/elasticsearch/forks","keys_url":"https://api.github.com/repos/astefan/elasticsearch/keys{/key_id}","collaborators_url":"https://api.github.com/repos/astefan/elasticsearch/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/astefan/elasticsearch/teams","hooks_url":"https://api.github.com/repos/astefan/elasticsearch/hooks","issue_events_url":"https://api.github.com/repos/astefan/elasticsearch/issues/events{/number}","events_url":"https://api.github.com/repos/astefan/elasticsearch/events","assignees_url":"https://api.github.com/repos/astefan/elasticsearch/assignees{/user}","branches_url":"https://api.github.com/repos/astefan/elasticsearch/branches{/branch}","tags_url":"https://api.github.com/repos/astefan/elasticsearch/tags","blobs_url":"https://api.github.com/repos/astefan/elasticsearch/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/astefan/elasticsearch/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/astefan/elasticsearch/git/refs{/sha}","trees_url":"https://api.github.com/repos/astefan/elasticsearch/git/trees{/sha}","statuses_url":"https://api.github.com/repos/astefan/elasticsearch/statuses/{sha}","languages_url":"https://api.github.com/repos/astefan/elasticsearch/languages","stargazers_url":"https://api.github.com/repos/astefan/elasticsearch/stargazers","contributors_url":"https://api.github.com/repos/astefan/elasticsearch/contributors","subscribers_url":"https://api.github.com/repos/astefan/elasticsearch/subscribers","subscription_url":"https://api.github.com/repos/astefan/elasticsearch/subscription","commits_url":"https://api.github.com/repos/astefan/elasticsearch/commits{/sha}","git_commits_url":"https://api.github.com/repos/astefan/elasticsearch/git/commits{/sha}","comments_url":"https://api.github.com/repos/astefan/elasticsearch/comments{/number}","issue_comment_url":"https://api.github.com/repos/astefan/elasticsearch/issues/comments{/number}","contents_url":"https://api.github.com/repos/astefan/elasticsearch/contents/{+path}","compare_url":"https://api.github.com/repos/astefan/elasticsearch/compare/{base}...{head}","merges_url":"https://api.github.com/repos/astefan/elasticsearch/merges","archive_url":"https://api.github.com/repos/astefan/elasticsearch/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/astefan/elasticsearch/downloads","issues_url":"https://api.github.com/repos/astefan/elasticsearch/issues{/number}","pulls_url":"https://api.github.com/repos/astefan/elasticsearch/pulls{/number}","milestones_url":"https://api.github.com/repos/astefan/elasticsearch/milestones{/number}","notifications_url":"https://api.github.com/repos/astefan/elasticsearch/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/astefan/elasticsearch/labels{/name}","releases_url":"https://api.github.com/repos/astefan/elasticsearch/releases{/id}","deployments_url":"https://api.github.com/repos/astefan/elasticsearch/deployments","created_at":"2018-05-16T04:08:17Z","updated_at":"2018-06-04T10:33:41Z","pushed_at":"2018-07-25T09:50:37Z","git_url":"git://github.com/astefan/elasticsearch.git","ssh_url":"git@github.com:astefan/elasticsearch.git","clone_url":"https://github.com/astefan/elasticsearch.git","svn_url":"https://github.com/astefan/elasticsearch","homepage":"https://www.elastic.co/products/elasticsearch","size":489658,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"elastic:master","ref":"master","sha":"6aea82956cb9b17481847d83d1881af3e96e3d52","user":{"login":"elastic","id":6764390,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY3NjQzOTA=","avatar_url":"https://avatars0.githubusercontent.com/u/6764390?v=4","gravatar_id":"","url":"https://api.github.com/users/elastic","html_url":"https://github.com/elastic","followers_url":"https://api.github.com/users/elastic/followers","following_url":"https://api.github.com/users/elastic/following{/other_user}","gists_url":"https://api.github.com/users/elastic/gists{/gist_id}","starred_url":"https://api.github.com/users/elastic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elastic/subscriptions","organizations_url":"https://api.github.com/users/elastic/orgs","repos_url":"https://api.github.com/users/elastic/repos","events_url":"https://api.github.com/users/elastic/events{/privacy}","received_events_url":"https://api.github.com/users/elastic/received_events","type":"Organization","site_admin":false},"repo":{"id":507775,"node_id":"MDEwOlJlcG9zaXRvcnk1MDc3NzU=","name":"elasticsearch","full_name":"elastic/elasticsearch","owner":{"login":"elastic","id":6764390,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY3NjQzOTA=","avatar_url":"https://avatars0.githubusercontent.com/u/6764390?v=4","gravatar_id":"","url":"https://api.github.com/users/elastic","html_url":"https://github.com/elastic","followers_url":"https://api.github.com/users/elastic/followers","following_url":"https://api.github.com/users/elastic/following{/other_user}","gists_url":"https://api.github.com/users/elastic/gists{/gist_id}","starred_url":"https://api.github.com/users/elastic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elastic/subscriptions","organizations_url":"https://api.github.com/users/elastic/orgs","repos_url":"https://api.github.com/users/elastic/repos","events_url":"https://api.github.com/users/elastic/events{/privacy}","received_events_url":"https://api.github.com/users/elastic/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/elastic/elasticsearch","description":"Open Source, Distributed, RESTful Search Engine","fork":false,"url":"https://api.github.com/repos/elastic/elasticsearch","forks_url":"https://api.github.com/repos/elastic/elasticsearch/forks","keys_url":"https://api.github.com/repos/elastic/elasticsearch/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elastic/elasticsearch/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elastic/elasticsearch/teams","hooks_url":"https://api.github.com/repos/elastic/elasticsearch/hooks","issue_events_url":"https://api.github.com/repos/elastic/elasticsearch/issues/events{/number}","events_url":"https://api.github.com/repos/elastic/elasticsearch/events","assignees_url":"https://api.github.com/repos/elastic/elasticsearch/assignees{/user}","branches_url":"https://api.github.com/repos/elastic/elasticsearch/branches{/branch}","tags_url":"https://api.github.com/repos/elastic/elasticsearch/tags","blobs_url":"https://api.github.com/repos/elastic/elasticsearch/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elastic/elasticsearch/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elastic/elasticsearch/git/refs{/sha}","trees_url":"https://api.github.com/repos/elastic/elasticsearch/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elastic/elasticsearch/statuses/{sha}","languages_url":"https://api.github.com/repos/elastic/elasticsearch/languages","stargazers_url":"https://api.github.com/repos/elastic/elasticsearch/stargazers","contributors_url":"https://api.github.com/repos/elastic/elasticsearch/contributors","subscribers_url":"https://api.github.com/repos/elastic/elasticsearch/subscribers","subscription_url":"https://api.github.com/repos/elastic/elasticsearch/subscription","commits_url":"https://api.github.com/repos/elastic/elasticsearch/commits{/sha}","git_commits_url":"https://api.github.com/repos/elastic/elasticsearch/git/commits{/sha}","comments_url":"https://api.github.com/repos/elastic/elasticsearch/comments{/number}","issue_comment_url":"https://api.github.com/repos/elastic/elasticsearch/issues/comments{/number}","contents_url":"https://api.github.com/repos/elastic/elasticsearch/contents/{+path}","compare_url":"https://api.github.com/repos/elastic/elasticsearch/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elastic/elasticsearch/merges","archive_url":"https://api.github.com/repos/elastic/elasticsearch/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elastic/elasticsearch/downloads","issues_url":"https://api.github.com/repos/elastic/elasticsearch/issues{/number}","pulls_url":"https://api.github.com/repos/elastic/elasticsearch/pulls{/number}","milestones_url":"https://api.github.com/repos/elastic/elasticsearch/milestones{/number}","notifications_url":"https://api.github.com/repos/elastic/elasticsearch/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elastic/elasticsearch/labels{/name}","releases_url":"https://api.github.com/repos/elastic/elasticsearch/releases{/id}","deployments_url":"https://api.github.com/repos/elastic/elasticsearch/deployments","created_at":"2010-02-08T13:20:56Z","updated_at":"2018-07-26T17:56:15Z","pushed_at":"2018-07-26T17:55:29Z","git_url":"git://github.com/elastic/elasticsearch.git","ssh_url":"git@github.com:elastic/elasticsearch.git","clone_url":"https://github.com/elastic/elasticsearch.git","svn_url":"https://github.com/elastic/elasticsearch","homepage":"https://www.elastic.co/products/elasticsearch","size":499182,"stargazers_count":32896,"watchers_count":32896,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":11237,"mirror_url":null,"archived":false,"open_issues_count":1573,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":11237,"open_issues":1573,"watchers":32896,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/32356"},"html":{"href":"https://github.com/elastic/elasticsearch/pull/32356"},"issue":{"href":"https://api.github.com/repos/elastic/elasticsearch/issues/32356"},"comments":{"href":"https://api.github.com/repos/elastic/elasticsearch/issues/32356/comments"},"review_comments":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/32356/comments"},"review_comment":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/32356/commits"},"statuses":{"href":"https://api.github.com/repos/elastic/elasticsearch/statuses/3a7e81b904a7e4b9f14561d4c9d45aecbc224477"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"nik9000"}}