{"action":"created","comment":{"url":"https://api.github.com/repos/confluentinc/ksql/pulls/comments/211120004","pull_request_review_id":147475964,"id":211120004,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxMTEyMDAwNA==","diff_hunk":"@@ -28,18 +28,25 @@\n \n   @Override\n   public Object evaluate(final Object... args) {\n-    if (args.length != 2) {\n-      throw new KsqlFunctionException(\"TimestampToString udf should have two input argument:\"\n-                                      + \" date value and format.\");\n+    if (args.length < 2) {\n+      throw new KsqlFunctionException(\"TimestampToString udf should have at least \"\n+                                    + \"two input arguments: date value and format.\");\n+    }\n+\n+    if (args.length > 3) {\n+      throw new KsqlFunctionException(\"TimestampToString udf should have at most \"\n+                                    + \"three input arguments: date value, format and zone.\");\n     }\n \n     try {\n       ensureInitialized(args);\n \n       final Timestamp timestamp = new Timestamp((Long) args[0]);\n+\n       return timestamp.toLocalDateTime()\n-          .atZone(ZoneId.systemDefault())\n+          .atZone(args.length == 3 ? ZoneId.of(args[2].toString()) : ZoneId.systemDefault())","path":"ksql-engine/src/main/java/io/confluent/ksql/function/udf/datetime/TimestampToString.java","position":24,"original_position":24,"commit_id":"6582e4d35b5b38306a9b8f4b6ce7ae6ac9576ddb","original_commit_id":"6582e4d35b5b38306a9b8f4b6ce7ae6ac9576ddb","user":{"login":"rodesai","id":2610028,"node_id":"MDQ6VXNlcjI2MTAwMjg=","avatar_url":"https://avatars0.githubusercontent.com/u/2610028?v=4","gravatar_id":"","url":"https://api.github.com/users/rodesai","html_url":"https://github.com/rodesai","followers_url":"https://api.github.com/users/rodesai/followers","following_url":"https://api.github.com/users/rodesai/following{/other_user}","gists_url":"https://api.github.com/users/rodesai/gists{/gist_id}","starred_url":"https://api.github.com/users/rodesai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rodesai/subscriptions","organizations_url":"https://api.github.com/users/rodesai/orgs","repos_url":"https://api.github.com/users/rodesai/repos","events_url":"https://api.github.com/users/rodesai/events{/privacy}","received_events_url":"https://api.github.com/users/rodesai/received_events","type":"User","site_admin":false},"body":"I believe this just adds a time zone, without adjusting the value of the datetime itself. So if you have a timestamp of 1534722957, you'll get a date time of 08:19:2018 16:55:57 (assuming you're system default is PST). Then, if you call atZone(ZoneId.of(\"GMT\")), you'll get back a zoned date time of 08:19:2018 16:55:57 GMT, which is not what we want. That's a different point in time than the original timestamp. I think what we want is to set the zone in the formatter. Also, can you add a test case that verifies that the zone adjustment is done correctly? Thanks!","created_at":"2018-08-20T00:03:39Z","updated_at":"2018-08-20T00:03:55Z","html_url":"https://github.com/confluentinc/ksql/pull/1750#discussion_r211120004","pull_request_url":"https://api.github.com/repos/confluentinc/ksql/pulls/1750","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/confluentinc/ksql/pulls/comments/211120004"},"html":{"href":"https://github.com/confluentinc/ksql/pull/1750#discussion_r211120004"},"pull_request":{"href":"https://api.github.com/repos/confluentinc/ksql/pulls/1750"}}},"pull_request":{"url":"https://api.github.com/repos/confluentinc/ksql/pulls/1750","id":209147809,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA5MTQ3ODA5","html_url":"https://github.com/confluentinc/ksql/pull/1750","diff_url":"https://github.com/confluentinc/ksql/pull/1750.diff","patch_url":"https://github.com/confluentinc/ksql/pull/1750.patch","issue_url":"https://api.github.com/repos/confluentinc/ksql/issues/1750","number":1750,"state":"open","locked":false,"title":"#1685 Add timezone for TIMESTAMPTOSTRING","user":{"login":"uurl","id":2509572,"node_id":"MDQ6VXNlcjI1MDk1NzI=","avatar_url":"https://avatars2.githubusercontent.com/u/2509572?v=4","gravatar_id":"","url":"https://api.github.com/users/uurl","html_url":"https://github.com/uurl","followers_url":"https://api.github.com/users/uurl/followers","following_url":"https://api.github.com/users/uurl/following{/other_user}","gists_url":"https://api.github.com/users/uurl/gists{/gist_id}","starred_url":"https://api.github.com/users/uurl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uurl/subscriptions","organizations_url":"https://api.github.com/users/uurl/orgs","repos_url":"https://api.github.com/users/uurl/repos","events_url":"https://api.github.com/users/uurl/events{/privacy}","received_events_url":"https://api.github.com/users/uurl/received_events","type":"User","site_admin":false},"body":"### Description \r\nThis PR fixes #1685 Add a way to specify the desired timezone for TIMESTAMPTOSTRING\r\n\r\n### Testing done \r\nmvn clean package\r\n\r\n### Reviewer checklist\r\n- [ ] Ensure docs are updated if necessary. (eg. if a user visible feature is being added or changed).\r\n- [ ] Ensure relevant issues are linked (description should include text like \"Fixes #<issue number>\")\r\n\r\n","created_at":"2018-08-17T13:26:51Z","updated_at":"2018-08-20T00:03:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9969bc3a34bb78508fd6c70c1f041fad19d76b7b","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/confluentinc/ksql/pulls/1750/commits","review_comments_url":"https://api.github.com/repos/confluentinc/ksql/pulls/1750/comments","review_comment_url":"https://api.github.com/repos/confluentinc/ksql/pulls/comments{/number}","comments_url":"https://api.github.com/repos/confluentinc/ksql/issues/1750/comments","statuses_url":"https://api.github.com/repos/confluentinc/ksql/statuses/6582e4d35b5b38306a9b8f4b6ce7ae6ac9576ddb","head":{"label":"uurl:issue1685","ref":"issue1685","sha":"6582e4d35b5b38306a9b8f4b6ce7ae6ac9576ddb","user":{"login":"uurl","id":2509572,"node_id":"MDQ6VXNlcjI1MDk1NzI=","avatar_url":"https://avatars2.githubusercontent.com/u/2509572?v=4","gravatar_id":"","url":"https://api.github.com/users/uurl","html_url":"https://github.com/uurl","followers_url":"https://api.github.com/users/uurl/followers","following_url":"https://api.github.com/users/uurl/following{/other_user}","gists_url":"https://api.github.com/users/uurl/gists{/gist_id}","starred_url":"https://api.github.com/users/uurl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uurl/subscriptions","organizations_url":"https://api.github.com/users/uurl/orgs","repos_url":"https://api.github.com/users/uurl/repos","events_url":"https://api.github.com/users/uurl/events{/privacy}","received_events_url":"https://api.github.com/users/uurl/received_events","type":"User","site_admin":false},"repo":{"id":145086040,"node_id":"MDEwOlJlcG9zaXRvcnkxNDUwODYwNDA=","name":"ksql","full_name":"uurl/ksql","owner":{"login":"uurl","id":2509572,"node_id":"MDQ6VXNlcjI1MDk1NzI=","avatar_url":"https://avatars2.githubusercontent.com/u/2509572?v=4","gravatar_id":"","url":"https://api.github.com/users/uurl","html_url":"https://github.com/uurl","followers_url":"https://api.github.com/users/uurl/followers","following_url":"https://api.github.com/users/uurl/following{/other_user}","gists_url":"https://api.github.com/users/uurl/gists{/gist_id}","starred_url":"https://api.github.com/users/uurl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uurl/subscriptions","organizations_url":"https://api.github.com/users/uurl/orgs","repos_url":"https://api.github.com/users/uurl/repos","events_url":"https://api.github.com/users/uurl/events{/privacy}","received_events_url":"https://api.github.com/users/uurl/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/uurl/ksql","description":"KSQL - the Streaming SQL Engine for Apache Kafka ","fork":true,"url":"https://api.github.com/repos/uurl/ksql","forks_url":"https://api.github.com/repos/uurl/ksql/forks","keys_url":"https://api.github.com/repos/uurl/ksql/keys{/key_id}","collaborators_url":"https://api.github.com/repos/uurl/ksql/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/uurl/ksql/teams","hooks_url":"https://api.github.com/repos/uurl/ksql/hooks","issue_events_url":"https://api.github.com/repos/uurl/ksql/issues/events{/number}","events_url":"https://api.github.com/repos/uurl/ksql/events","assignees_url":"https://api.github.com/repos/uurl/ksql/assignees{/user}","branches_url":"https://api.github.com/repos/uurl/ksql/branches{/branch}","tags_url":"https://api.github.com/repos/uurl/ksql/tags","blobs_url":"https://api.github.com/repos/uurl/ksql/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/uurl/ksql/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/uurl/ksql/git/refs{/sha}","trees_url":"https://api.github.com/repos/uurl/ksql/git/trees{/sha}","statuses_url":"https://api.github.com/repos/uurl/ksql/statuses/{sha}","languages_url":"https://api.github.com/repos/uurl/ksql/languages","stargazers_url":"https://api.github.com/repos/uurl/ksql/stargazers","contributors_url":"https://api.github.com/repos/uurl/ksql/contributors","subscribers_url":"https://api.github.com/repos/uurl/ksql/subscribers","subscription_url":"https://api.github.com/repos/uurl/ksql/subscription","commits_url":"https://api.github.com/repos/uurl/ksql/commits{/sha}","git_commits_url":"https://api.github.com/repos/uurl/ksql/git/commits{/sha}","comments_url":"https://api.github.com/repos/uurl/ksql/comments{/number}","issue_comment_url":"https://api.github.com/repos/uurl/ksql/issues/comments{/number}","contents_url":"https://api.github.com/repos/uurl/ksql/contents/{+path}","compare_url":"https://api.github.com/repos/uurl/ksql/compare/{base}...{head}","merges_url":"https://api.github.com/repos/uurl/ksql/merges","archive_url":"https://api.github.com/repos/uurl/ksql/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/uurl/ksql/downloads","issues_url":"https://api.github.com/repos/uurl/ksql/issues{/number}","pulls_url":"https://api.github.com/repos/uurl/ksql/pulls{/number}","milestones_url":"https://api.github.com/repos/uurl/ksql/milestones{/number}","notifications_url":"https://api.github.com/repos/uurl/ksql/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/uurl/ksql/labels{/name}","releases_url":"https://api.github.com/repos/uurl/ksql/releases{/id}","deployments_url":"https://api.github.com/repos/uurl/ksql/deployments","created_at":"2018-08-17T07:16:39Z","updated_at":"2018-08-17T07:16:44Z","pushed_at":"2018-08-17T13:25:12Z","git_url":"git://github.com/uurl/ksql.git","ssh_url":"git@github.com:uurl/ksql.git","clone_url":"https://github.com/uurl/ksql.git","svn_url":"https://github.com/uurl/ksql","homepage":"","size":10009,"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":"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":"confluentinc:master","ref":"master","sha":"189ec19521ff9bd6a196f5eea4ed57c8d8454cb8","user":{"login":"confluentinc","id":9439498,"node_id":"MDEyOk9yZ2FuaXphdGlvbjk0Mzk0OTg=","avatar_url":"https://avatars0.githubusercontent.com/u/9439498?v=4","gravatar_id":"","url":"https://api.github.com/users/confluentinc","html_url":"https://github.com/confluentinc","followers_url":"https://api.github.com/users/confluentinc/followers","following_url":"https://api.github.com/users/confluentinc/following{/other_user}","gists_url":"https://api.github.com/users/confluentinc/gists{/gist_id}","starred_url":"https://api.github.com/users/confluentinc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/confluentinc/subscriptions","organizations_url":"https://api.github.com/users/confluentinc/orgs","repos_url":"https://api.github.com/users/confluentinc/repos","events_url":"https://api.github.com/users/confluentinc/events{/privacy}","received_events_url":"https://api.github.com/users/confluentinc/received_events","type":"Organization","site_admin":false},"repo":{"id":69400326,"node_id":"MDEwOlJlcG9zaXRvcnk2OTQwMDMyNg==","name":"ksql","full_name":"confluentinc/ksql","owner":{"login":"confluentinc","id":9439498,"node_id":"MDEyOk9yZ2FuaXphdGlvbjk0Mzk0OTg=","avatar_url":"https://avatars0.githubusercontent.com/u/9439498?v=4","gravatar_id":"","url":"https://api.github.com/users/confluentinc","html_url":"https://github.com/confluentinc","followers_url":"https://api.github.com/users/confluentinc/followers","following_url":"https://api.github.com/users/confluentinc/following{/other_user}","gists_url":"https://api.github.com/users/confluentinc/gists{/gist_id}","starred_url":"https://api.github.com/users/confluentinc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/confluentinc/subscriptions","organizations_url":"https://api.github.com/users/confluentinc/orgs","repos_url":"https://api.github.com/users/confluentinc/repos","events_url":"https://api.github.com/users/confluentinc/events{/privacy}","received_events_url":"https://api.github.com/users/confluentinc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/confluentinc/ksql","description":"KSQL - the Streaming SQL Engine for Apache Kafka ","fork":false,"url":"https://api.github.com/repos/confluentinc/ksql","forks_url":"https://api.github.com/repos/confluentinc/ksql/forks","keys_url":"https://api.github.com/repos/confluentinc/ksql/keys{/key_id}","collaborators_url":"https://api.github.com/repos/confluentinc/ksql/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/confluentinc/ksql/teams","hooks_url":"https://api.github.com/repos/confluentinc/ksql/hooks","issue_events_url":"https://api.github.com/repos/confluentinc/ksql/issues/events{/number}","events_url":"https://api.github.com/repos/confluentinc/ksql/events","assignees_url":"https://api.github.com/repos/confluentinc/ksql/assignees{/user}","branches_url":"https://api.github.com/repos/confluentinc/ksql/branches{/branch}","tags_url":"https://api.github.com/repos/confluentinc/ksql/tags","blobs_url":"https://api.github.com/repos/confluentinc/ksql/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/confluentinc/ksql/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/confluentinc/ksql/git/refs{/sha}","trees_url":"https://api.github.com/repos/confluentinc/ksql/git/trees{/sha}","statuses_url":"https://api.github.com/repos/confluentinc/ksql/statuses/{sha}","languages_url":"https://api.github.com/repos/confluentinc/ksql/languages","stargazers_url":"https://api.github.com/repos/confluentinc/ksql/stargazers","contributors_url":"https://api.github.com/repos/confluentinc/ksql/contributors","subscribers_url":"https://api.github.com/repos/confluentinc/ksql/subscribers","subscription_url":"https://api.github.com/repos/confluentinc/ksql/subscription","commits_url":"https://api.github.com/repos/confluentinc/ksql/commits{/sha}","git_commits_url":"https://api.github.com/repos/confluentinc/ksql/git/commits{/sha}","comments_url":"https://api.github.com/repos/confluentinc/ksql/comments{/number}","issue_comment_url":"https://api.github.com/repos/confluentinc/ksql/issues/comments{/number}","contents_url":"https://api.github.com/repos/confluentinc/ksql/contents/{+path}","compare_url":"https://api.github.com/repos/confluentinc/ksql/compare/{base}...{head}","merges_url":"https://api.github.com/repos/confluentinc/ksql/merges","archive_url":"https://api.github.com/repos/confluentinc/ksql/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/confluentinc/ksql/downloads","issues_url":"https://api.github.com/repos/confluentinc/ksql/issues{/number}","pulls_url":"https://api.github.com/repos/confluentinc/ksql/pulls{/number}","milestones_url":"https://api.github.com/repos/confluentinc/ksql/milestones{/number}","notifications_url":"https://api.github.com/repos/confluentinc/ksql/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/confluentinc/ksql/labels{/name}","releases_url":"https://api.github.com/repos/confluentinc/ksql/releases{/id}","deployments_url":"https://api.github.com/repos/confluentinc/ksql/deployments","created_at":"2016-09-27T21:30:15Z","updated_at":"2018-08-19T22:45:41Z","pushed_at":"2018-08-19T17:32:01Z","git_url":"git://github.com/confluentinc/ksql.git","ssh_url":"git@github.com:confluentinc/ksql.git","clone_url":"https://github.com/confluentinc/ksql.git","svn_url":"https://github.com/confluentinc/ksql","homepage":"","size":10364,"stargazers_count":1857,"watchers_count":1857,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":352,"mirror_url":null,"archived":false,"open_issues_count":345,"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":352,"open_issues":345,"watchers":1857,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/confluentinc/ksql/pulls/1750"},"html":{"href":"https://github.com/confluentinc/ksql/pull/1750"},"issue":{"href":"https://api.github.com/repos/confluentinc/ksql/issues/1750"},"comments":{"href":"https://api.github.com/repos/confluentinc/ksql/issues/1750/comments"},"review_comments":{"href":"https://api.github.com/repos/confluentinc/ksql/pulls/1750/comments"},"review_comment":{"href":"https://api.github.com/repos/confluentinc/ksql/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/confluentinc/ksql/pulls/1750/commits"},"statuses":{"href":"https://api.github.com/repos/confluentinc/ksql/statuses/6582e4d35b5b38306a9b8f4b6ce7ae6ac9576ddb"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"rodesai"}}