{"action":"opened","number":5735,"pull_request":{"url":"https://api.github.com/repos/apache/flink/pulls/5735","id":176462325,"html_url":"https://github.com/apache/flink/pull/5735","diff_url":"https://github.com/apache/flink/pull/5735.diff","patch_url":"https://github.com/apache/flink/pull/5735.patch","issue_url":"https://api.github.com/repos/apache/flink/issues/5735","number":5735,"state":"open","locked":false,"title":" [FLINK-9036] [core] Add default values to State Descriptors via suppliers","user":{"login":"StephanEwen","id":1727146,"avatar_url":"https://avatars3.githubusercontent.com/u/1727146?v=4","gravatar_id":"","url":"https://api.github.com/users/StephanEwen","html_url":"https://github.com/StephanEwen","followers_url":"https://api.github.com/users/StephanEwen/followers","following_url":"https://api.github.com/users/StephanEwen/following{/other_user}","gists_url":"https://api.github.com/users/StephanEwen/gists{/gist_id}","starred_url":"https://api.github.com/users/StephanEwen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StephanEwen/subscriptions","organizations_url":"https://api.github.com/users/StephanEwen/orgs","repos_url":"https://api.github.com/users/StephanEwen/repos","events_url":"https://api.github.com/users/StephanEwen/events{/privacy}","received_events_url":"https://api.github.com/users/StephanEwen/received_events","type":"User","site_admin":false},"body":"**This PR is based on #5732 and only the last two commits are relevant for this PR**\r\n\r\n## What is the purpose of the change\r\n\r\nEarlier versions had a default value in `ValueState`. We dropped that, because the value would have to be duplicated on each access, to be safe against side effects when using mutable types.\r\n\r\nThis pull request re-adds the feature, but using a supplier/factory function to create the default value on access. This is more efficient than copying a shared default value on access.\r\n\r\n## Brief change log\r\n\r\n  - The `StateDescriptor` produces default values through a optional `Supplier` function.\r\n  - For backwards compatibility, the mode to pass directly a value is kept. The value is wrapped in a `DefaultValueFactory` which implements the legacy functionality using a serializer to copy the value on each access.\r\n\r\n## Verifying this change\r\n\r\n  - This change adds a set of unit tests\r\n  - The change modifies one example program (`StateMachineExample`). Running that example shows how the change works end-to-end.\r\n\r\n## Does this pull request potentially affect one of the following parts:\r\n\r\n  - Dependencies (does it add or upgrade a dependency): (yes / no)\r\n  - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: (yes / no)\r\n  - The serializers: (yes / no / don't know)\r\n  - The runtime per-record code paths (performance sensitive): (yes / no / don't know)\r\n  - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Yarn/Mesos, ZooKeeper: (yes / no / don't know)\r\n  - The S3 file system connector: (yes / no / don't know)\r\n\r\n## Documentation\r\n\r\n  - Does this pull request introduce a new feature? (yes / no)\r\n  - If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)\r\n","created_at":"2018-03-21T12:36:59Z","updated_at":"2018-03-21T12:36:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/apache/flink/pulls/5735/commits","review_comments_url":"https://api.github.com/repos/apache/flink/pulls/5735/comments","review_comment_url":"https://api.github.com/repos/apache/flink/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/flink/issues/5735/comments","statuses_url":"https://api.github.com/repos/apache/flink/statuses/6d7757017f52f7c3fd7cbe99d05f1de63186d12d","head":{"label":"StephanEwen:state_default_values","ref":"state_default_values","sha":"6d7757017f52f7c3fd7cbe99d05f1de63186d12d","user":{"login":"StephanEwen","id":1727146,"avatar_url":"https://avatars3.githubusercontent.com/u/1727146?v=4","gravatar_id":"","url":"https://api.github.com/users/StephanEwen","html_url":"https://github.com/StephanEwen","followers_url":"https://api.github.com/users/StephanEwen/followers","following_url":"https://api.github.com/users/StephanEwen/following{/other_user}","gists_url":"https://api.github.com/users/StephanEwen/gists{/gist_id}","starred_url":"https://api.github.com/users/StephanEwen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StephanEwen/subscriptions","organizations_url":"https://api.github.com/users/StephanEwen/orgs","repos_url":"https://api.github.com/users/StephanEwen/repos","events_url":"https://api.github.com/users/StephanEwen/events{/privacy}","received_events_url":"https://api.github.com/users/StephanEwen/received_events","type":"User","site_admin":false},"repo":{"id":21171031,"name":"incubator-flink","full_name":"StephanEwen/incubator-flink","owner":{"login":"StephanEwen","id":1727146,"avatar_url":"https://avatars3.githubusercontent.com/u/1727146?v=4","gravatar_id":"","url":"https://api.github.com/users/StephanEwen","html_url":"https://github.com/StephanEwen","followers_url":"https://api.github.com/users/StephanEwen/followers","following_url":"https://api.github.com/users/StephanEwen/following{/other_user}","gists_url":"https://api.github.com/users/StephanEwen/gists{/gist_id}","starred_url":"https://api.github.com/users/StephanEwen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StephanEwen/subscriptions","organizations_url":"https://api.github.com/users/StephanEwen/orgs","repos_url":"https://api.github.com/users/StephanEwen/repos","events_url":"https://api.github.com/users/StephanEwen/events{/privacy}","received_events_url":"https://api.github.com/users/StephanEwen/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/StephanEwen/incubator-flink","description":"Mirror of Apache Flink","fork":true,"url":"https://api.github.com/repos/StephanEwen/incubator-flink","forks_url":"https://api.github.com/repos/StephanEwen/incubator-flink/forks","keys_url":"https://api.github.com/repos/StephanEwen/incubator-flink/keys{/key_id}","collaborators_url":"https://api.github.com/repos/StephanEwen/incubator-flink/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/StephanEwen/incubator-flink/teams","hooks_url":"https://api.github.com/repos/StephanEwen/incubator-flink/hooks","issue_events_url":"https://api.github.com/repos/StephanEwen/incubator-flink/issues/events{/number}","events_url":"https://api.github.com/repos/StephanEwen/incubator-flink/events","assignees_url":"https://api.github.com/repos/StephanEwen/incubator-flink/assignees{/user}","branches_url":"https://api.github.com/repos/StephanEwen/incubator-flink/branches{/branch}","tags_url":"https://api.github.com/repos/StephanEwen/incubator-flink/tags","blobs_url":"https://api.github.com/repos/StephanEwen/incubator-flink/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/StephanEwen/incubator-flink/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/StephanEwen/incubator-flink/git/refs{/sha}","trees_url":"https://api.github.com/repos/StephanEwen/incubator-flink/git/trees{/sha}","statuses_url":"https://api.github.com/repos/StephanEwen/incubator-flink/statuses/{sha}","languages_url":"https://api.github.com/repos/StephanEwen/incubator-flink/languages","stargazers_url":"https://api.github.com/repos/StephanEwen/incubator-flink/stargazers","contributors_url":"https://api.github.com/repos/StephanEwen/incubator-flink/contributors","subscribers_url":"https://api.github.com/repos/StephanEwen/incubator-flink/subscribers","subscription_url":"https://api.github.com/repos/StephanEwen/incubator-flink/subscription","commits_url":"https://api.github.com/repos/StephanEwen/incubator-flink/commits{/sha}","git_commits_url":"https://api.github.com/repos/StephanEwen/incubator-flink/git/commits{/sha}","comments_url":"https://api.github.com/repos/StephanEwen/incubator-flink/comments{/number}","issue_comment_url":"https://api.github.com/repos/StephanEwen/incubator-flink/issues/comments{/number}","contents_url":"https://api.github.com/repos/StephanEwen/incubator-flink/contents/{+path}","compare_url":"https://api.github.com/repos/StephanEwen/incubator-flink/compare/{base}...{head}","merges_url":"https://api.github.com/repos/StephanEwen/incubator-flink/merges","archive_url":"https://api.github.com/repos/StephanEwen/incubator-flink/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/StephanEwen/incubator-flink/downloads","issues_url":"https://api.github.com/repos/StephanEwen/incubator-flink/issues{/number}","pulls_url":"https://api.github.com/repos/StephanEwen/incubator-flink/pulls{/number}","milestones_url":"https://api.github.com/repos/StephanEwen/incubator-flink/milestones{/number}","notifications_url":"https://api.github.com/repos/StephanEwen/incubator-flink/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/StephanEwen/incubator-flink/labels{/name}","releases_url":"https://api.github.com/repos/StephanEwen/incubator-flink/releases{/id}","deployments_url":"https://api.github.com/repos/StephanEwen/incubator-flink/deployments","created_at":"2014-06-24T15:57:00Z","updated_at":"2018-03-21T10:38:07Z","pushed_at":"2018-03-21T12:26:28Z","git_url":"git://github.com/StephanEwen/incubator-flink.git","ssh_url":"git@github.com:StephanEwen/incubator-flink.git","clone_url":"https://github.com/StephanEwen/incubator-flink.git","svn_url":"https://github.com/StephanEwen/incubator-flink","homepage":null,"size":149163,"stargazers_count":3,"watchers_count":3,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3,"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"},"forks":3,"open_issues":0,"watchers":3,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"363e8d2d6513e49929dfb280c3be420fb1af0bcd","user":{"login":"apache","id":47359,"avatar_url":"https://avatars0.githubusercontent.com/u/47359?v=4","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":20587599,"name":"flink","full_name":"apache/flink","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars0.githubusercontent.com/u/47359?v=4","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/flink","description":"Mirror of Apache Flink","fork":false,"url":"https://api.github.com/repos/apache/flink","forks_url":"https://api.github.com/repos/apache/flink/forks","keys_url":"https://api.github.com/repos/apache/flink/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/flink/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/flink/teams","hooks_url":"https://api.github.com/repos/apache/flink/hooks","issue_events_url":"https://api.github.com/repos/apache/flink/issues/events{/number}","events_url":"https://api.github.com/repos/apache/flink/events","assignees_url":"https://api.github.com/repos/apache/flink/assignees{/user}","branches_url":"https://api.github.com/repos/apache/flink/branches{/branch}","tags_url":"https://api.github.com/repos/apache/flink/tags","blobs_url":"https://api.github.com/repos/apache/flink/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/flink/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/flink/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/flink/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/flink/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/flink/languages","stargazers_url":"https://api.github.com/repos/apache/flink/stargazers","contributors_url":"https://api.github.com/repos/apache/flink/contributors","subscribers_url":"https://api.github.com/repos/apache/flink/subscribers","subscription_url":"https://api.github.com/repos/apache/flink/subscription","commits_url":"https://api.github.com/repos/apache/flink/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/flink/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/flink/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/flink/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/flink/contents/{+path}","compare_url":"https://api.github.com/repos/apache/flink/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/flink/merges","archive_url":"https://api.github.com/repos/apache/flink/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/flink/downloads","issues_url":"https://api.github.com/repos/apache/flink/issues{/number}","pulls_url":"https://api.github.com/repos/apache/flink/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/flink/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/flink/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/flink/labels{/name}","releases_url":"https://api.github.com/repos/apache/flink/releases{/id}","deployments_url":"https://api.github.com/repos/apache/flink/deployments","created_at":"2014-06-07T07:00:10Z","updated_at":"2018-03-21T11:13:02Z","pushed_at":"2018-03-21T11:12:42Z","git_url":"git://github.com/apache/flink.git","ssh_url":"git@github.com:apache/flink.git","clone_url":"https://github.com/apache/flink.git","svn_url":"https://github.com/apache/flink","homepage":null,"size":150641,"stargazers_count":3436,"watchers_count":3436,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2348,"mirror_url":null,"archived":false,"open_issues_count":334,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":2348,"open_issues":334,"watchers":3436,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/flink/pulls/5735"},"html":{"href":"https://github.com/apache/flink/pull/5735"},"issue":{"href":"https://api.github.com/repos/apache/flink/issues/5735"},"comments":{"href":"https://api.github.com/repos/apache/flink/issues/5735/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/flink/pulls/5735/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/flink/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/flink/pulls/5735/commits"},"statuses":{"href":"https://api.github.com/repos/apache/flink/statuses/6d7757017f52f7c3fd7cbe99d05f1de63186d12d"}},"author_association":"CONTRIBUTOR","merged":false,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"maintainer_can_modify":true,"commits":8,"additions":813,"deletions":692,"changed_files":18}}
{"actor":{"display_login":"StephanEwen"}}