{"action":"created","comment":{"url":"https://api.github.com/repos/uber/petastorm/pulls/comments/221096019","pull_request_review_id":159644124,"id":221096019,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMTA5NjAxOQ==","diff_hunk":"@@ -221,7 +271,24 @@ def dict_to_spark_row(unischema, row_dict):\n                 raise ValueError('Field {} is not \"nullable\", but got passes a None value')\n         encoded_dict[field_name] = schema_field.codec.encode(schema_field, value) if value is not None else None\n \n-    return Row(**encoded_dict)\n+    if not unischema.column_bundles:\n+        return Row(**encoded_dict)\n+    else:\n+        bundled_dict = {}\n+        included_field_names = set()\n+        for bundle_name, bundle_columns in unischema.column_bundles.items():\n+            bundle_vals = [encoded_dict[field_name] for field_name in bundle_columns]\n+            numpy_array = np.array(bundle_vals, dtype=object)\n+            # Make a unischema field for the bundle to use the NdarrayCodec for serialization\n+            unischema_field = UnischemaField(bundle_name, numpy_array.dtype, numpy_array.shape,","path":"petastorm/unischema.py","position":133,"original_position":133,"commit_id":"bd094ada14fccaf1d5db0535b9e6100deedb735e","original_commit_id":"bd094ada14fccaf1d5db0535b9e6100deedb735e","user":{"login":"selitvin","id":3310092,"node_id":"MDQ6VXNlcjMzMTAwOTI=","avatar_url":"https://avatars2.githubusercontent.com/u/3310092?v=4","gravatar_id":"","url":"https://api.github.com/users/selitvin","html_url":"https://github.com/selitvin","followers_url":"https://api.github.com/users/selitvin/followers","following_url":"https://api.github.com/users/selitvin/following{/other_user}","gists_url":"https://api.github.com/users/selitvin/gists{/gist_id}","starred_url":"https://api.github.com/users/selitvin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/selitvin/subscriptions","organizations_url":"https://api.github.com/users/selitvin/orgs","repos_url":"https://api.github.com/users/selitvin/repos","events_url":"https://api.github.com/users/selitvin/events{/privacy}","received_events_url":"https://api.github.com/users/selitvin/received_events","type":"User","site_admin":false},"body":"Are you sure `NdarrayCodec` is a good level of reuse here? We don't use validation and 'faking' UnischemaField just to call the encode of the codec seems a bit awkward? If I understand correctly, you are really interested in these three lines:\r\n```\r\n        memfile = BytesIO()\r\n        np.save(memfile, array)\r\n        return bytearray(memfile.getvalue())\r\n```\r\nMaybe if Bundle becomes an separate object it can also serialize/deserialize itself?\r\n","created_at":"2018-09-27T22:25:38Z","updated_at":"2018-09-27T22:55:45Z","html_url":"https://github.com/uber/petastorm/pull/188#discussion_r221096019","pull_request_url":"https://api.github.com/repos/uber/petastorm/pulls/188","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/uber/petastorm/pulls/comments/221096019"},"html":{"href":"https://github.com/uber/petastorm/pull/188#discussion_r221096019"},"pull_request":{"href":"https://api.github.com/repos/uber/petastorm/pulls/188"}}},"pull_request":{"url":"https://api.github.com/repos/uber/petastorm/pulls/188","id":218772712,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE4NzcyNzEy","html_url":"https://github.com/uber/petastorm/pull/188","diff_url":"https://github.com/uber/petastorm/pull/188.diff","patch_url":"https://github.com/uber/petastorm/pull/188.patch","issue_url":"https://api.github.com/repos/uber/petastorm/issues/188","number":188,"state":"open","locked":false,"title":"Add ability to bundle unischema fields for storage","user":{"login":"rgruener","id":1903915,"node_id":"MDQ6VXNlcjE5MDM5MTU=","avatar_url":"https://avatars0.githubusercontent.com/u/1903915?v=4","gravatar_id":"","url":"https://api.github.com/users/rgruener","html_url":"https://github.com/rgruener","followers_url":"https://api.github.com/users/rgruener/followers","following_url":"https://api.github.com/users/rgruener/following{/other_user}","gists_url":"https://api.github.com/users/rgruener/gists{/gist_id}","starred_url":"https://api.github.com/users/rgruener/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rgruener/subscriptions","organizations_url":"https://api.github.com/users/rgruener/orgs","repos_url":"https://api.github.com/users/rgruener/repos","events_url":"https://api.github.com/users/rgruener/events{/privacy}","received_events_url":"https://api.github.com/users/rgruener/received_events","type":"User","site_admin":false},"body":"I still need to add some more tests and improve documentation but it should be open for feedback.\r\n\r\nNote one design choice I have included is that a field can be in multiple bundles, meaning you can include a small field multiple times in a row stored in different columns. This can be useful if you commonly need the same small piece of metadata with 2 large fields which can be read separately.\r\n\r\nI know we had discussions on predicates on decoded data but I will do that in a separate PR since that change is unrelated to bundling.","created_at":"2018-09-27T20:03:42Z","updated_at":"2018-09-27T22:55:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"36783da01b3ba177c6e159b4d87e6a2862d2deb1","assignee":{"login":"rgruener","id":1903915,"node_id":"MDQ6VXNlcjE5MDM5MTU=","avatar_url":"https://avatars0.githubusercontent.com/u/1903915?v=4","gravatar_id":"","url":"https://api.github.com/users/rgruener","html_url":"https://github.com/rgruener","followers_url":"https://api.github.com/users/rgruener/followers","following_url":"https://api.github.com/users/rgruener/following{/other_user}","gists_url":"https://api.github.com/users/rgruener/gists{/gist_id}","starred_url":"https://api.github.com/users/rgruener/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rgruener/subscriptions","organizations_url":"https://api.github.com/users/rgruener/orgs","repos_url":"https://api.github.com/users/rgruener/repos","events_url":"https://api.github.com/users/rgruener/events{/privacy}","received_events_url":"https://api.github.com/users/rgruener/received_events","type":"User","site_admin":false},"assignees":[{"login":"rgruener","id":1903915,"node_id":"MDQ6VXNlcjE5MDM5MTU=","avatar_url":"https://avatars0.githubusercontent.com/u/1903915?v=4","gravatar_id":"","url":"https://api.github.com/users/rgruener","html_url":"https://github.com/rgruener","followers_url":"https://api.github.com/users/rgruener/followers","following_url":"https://api.github.com/users/rgruener/following{/other_user}","gists_url":"https://api.github.com/users/rgruener/gists{/gist_id}","starred_url":"https://api.github.com/users/rgruener/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rgruener/subscriptions","organizations_url":"https://api.github.com/users/rgruener/orgs","repos_url":"https://api.github.com/users/rgruener/repos","events_url":"https://api.github.com/users/rgruener/events{/privacy}","received_events_url":"https://api.github.com/users/rgruener/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":{"url":"https://api.github.com/repos/uber/petastorm/milestones/2","html_url":"https://github.com/uber/petastorm/milestone/2","labels_url":"https://api.github.com/repos/uber/petastorm/milestones/2/labels","id":3652695,"node_id":"MDk6TWlsZXN0b25lMzY1MjY5NQ==","number":2,"title":"0.5.0","description":null,"creator":{"login":"selitvin","id":3310092,"node_id":"MDQ6VXNlcjMzMTAwOTI=","avatar_url":"https://avatars2.githubusercontent.com/u/3310092?v=4","gravatar_id":"","url":"https://api.github.com/users/selitvin","html_url":"https://github.com/selitvin","followers_url":"https://api.github.com/users/selitvin/followers","following_url":"https://api.github.com/users/selitvin/following{/other_user}","gists_url":"https://api.github.com/users/selitvin/gists{/gist_id}","starred_url":"https://api.github.com/users/selitvin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/selitvin/subscriptions","organizations_url":"https://api.github.com/users/selitvin/orgs","repos_url":"https://api.github.com/users/selitvin/repos","events_url":"https://api.github.com/users/selitvin/events{/privacy}","received_events_url":"https://api.github.com/users/selitvin/received_events","type":"User","site_admin":false},"open_issues":10,"closed_issues":0,"state":"open","created_at":"2018-09-13T19:01:10Z","updated_at":"2018-09-27T20:04:18Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/uber/petastorm/pulls/188/commits","review_comments_url":"https://api.github.com/repos/uber/petastorm/pulls/188/comments","review_comment_url":"https://api.github.com/repos/uber/petastorm/pulls/comments{/number}","comments_url":"https://api.github.com/repos/uber/petastorm/issues/188/comments","statuses_url":"https://api.github.com/repos/uber/petastorm/statuses/bd094ada14fccaf1d5db0535b9e6100deedb735e","head":{"label":"rgruener:bundles","ref":"bundles","sha":"bd094ada14fccaf1d5db0535b9e6100deedb735e","user":{"login":"rgruener","id":1903915,"node_id":"MDQ6VXNlcjE5MDM5MTU=","avatar_url":"https://avatars0.githubusercontent.com/u/1903915?v=4","gravatar_id":"","url":"https://api.github.com/users/rgruener","html_url":"https://github.com/rgruener","followers_url":"https://api.github.com/users/rgruener/followers","following_url":"https://api.github.com/users/rgruener/following{/other_user}","gists_url":"https://api.github.com/users/rgruener/gists{/gist_id}","starred_url":"https://api.github.com/users/rgruener/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rgruener/subscriptions","organizations_url":"https://api.github.com/users/rgruener/orgs","repos_url":"https://api.github.com/users/rgruener/repos","events_url":"https://api.github.com/users/rgruener/events{/privacy}","received_events_url":"https://api.github.com/users/rgruener/received_events","type":"User","site_admin":false},"repo":{"id":145161715,"node_id":"MDEwOlJlcG9zaXRvcnkxNDUxNjE3MTU=","name":"petastorm","full_name":"rgruener/petastorm","private":false,"owner":{"login":"rgruener","id":1903915,"node_id":"MDQ6VXNlcjE5MDM5MTU=","avatar_url":"https://avatars0.githubusercontent.com/u/1903915?v=4","gravatar_id":"","url":"https://api.github.com/users/rgruener","html_url":"https://github.com/rgruener","followers_url":"https://api.github.com/users/rgruener/followers","following_url":"https://api.github.com/users/rgruener/following{/other_user}","gists_url":"https://api.github.com/users/rgruener/gists{/gist_id}","starred_url":"https://api.github.com/users/rgruener/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rgruener/subscriptions","organizations_url":"https://api.github.com/users/rgruener/orgs","repos_url":"https://api.github.com/users/rgruener/repos","events_url":"https://api.github.com/users/rgruener/events{/privacy}","received_events_url":"https://api.github.com/users/rgruener/received_events","type":"User","site_admin":false},"html_url":"https://github.com/rgruener/petastorm","description":null,"fork":true,"url":"https://api.github.com/repos/rgruener/petastorm","forks_url":"https://api.github.com/repos/rgruener/petastorm/forks","keys_url":"https://api.github.com/repos/rgruener/petastorm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rgruener/petastorm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rgruener/petastorm/teams","hooks_url":"https://api.github.com/repos/rgruener/petastorm/hooks","issue_events_url":"https://api.github.com/repos/rgruener/petastorm/issues/events{/number}","events_url":"https://api.github.com/repos/rgruener/petastorm/events","assignees_url":"https://api.github.com/repos/rgruener/petastorm/assignees{/user}","branches_url":"https://api.github.com/repos/rgruener/petastorm/branches{/branch}","tags_url":"https://api.github.com/repos/rgruener/petastorm/tags","blobs_url":"https://api.github.com/repos/rgruener/petastorm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rgruener/petastorm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rgruener/petastorm/git/refs{/sha}","trees_url":"https://api.github.com/repos/rgruener/petastorm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rgruener/petastorm/statuses/{sha}","languages_url":"https://api.github.com/repos/rgruener/petastorm/languages","stargazers_url":"https://api.github.com/repos/rgruener/petastorm/stargazers","contributors_url":"https://api.github.com/repos/rgruener/petastorm/contributors","subscribers_url":"https://api.github.com/repos/rgruener/petastorm/subscribers","subscription_url":"https://api.github.com/repos/rgruener/petastorm/subscription","commits_url":"https://api.github.com/repos/rgruener/petastorm/commits{/sha}","git_commits_url":"https://api.github.com/repos/rgruener/petastorm/git/commits{/sha}","comments_url":"https://api.github.com/repos/rgruener/petastorm/comments{/number}","issue_comment_url":"https://api.github.com/repos/rgruener/petastorm/issues/comments{/number}","contents_url":"https://api.github.com/repos/rgruener/petastorm/contents/{+path}","compare_url":"https://api.github.com/repos/rgruener/petastorm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rgruener/petastorm/merges","archive_url":"https://api.github.com/repos/rgruener/petastorm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rgruener/petastorm/downloads","issues_url":"https://api.github.com/repos/rgruener/petastorm/issues{/number}","pulls_url":"https://api.github.com/repos/rgruener/petastorm/pulls{/number}","milestones_url":"https://api.github.com/repos/rgruener/petastorm/milestones{/number}","notifications_url":"https://api.github.com/repos/rgruener/petastorm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rgruener/petastorm/labels{/name}","releases_url":"https://api.github.com/repos/rgruener/petastorm/releases{/id}","deployments_url":"https://api.github.com/repos/rgruener/petastorm/deployments","created_at":"2018-08-17T20:03:10Z","updated_at":"2018-09-14T19:25:18Z","pushed_at":"2018-09-27T20:19:26Z","git_url":"git://github.com/rgruener/petastorm.git","ssh_url":"git@github.com:rgruener/petastorm.git","clone_url":"https://github.com/rgruener/petastorm.git","svn_url":"https://github.com/rgruener/petastorm","homepage":null,"size":554,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"uber:master","ref":"master","sha":"675348d5cce3dfd5a80d131eb9e2c2a344c8fcc6","user":{"login":"uber","id":538264,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUzODI2NA==","avatar_url":"https://avatars3.githubusercontent.com/u/538264?v=4","gravatar_id":"","url":"https://api.github.com/users/uber","html_url":"https://github.com/uber","followers_url":"https://api.github.com/users/uber/followers","following_url":"https://api.github.com/users/uber/following{/other_user}","gists_url":"https://api.github.com/users/uber/gists{/gist_id}","starred_url":"https://api.github.com/users/uber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uber/subscriptions","organizations_url":"https://api.github.com/users/uber/orgs","repos_url":"https://api.github.com/users/uber/repos","events_url":"https://api.github.com/users/uber/events{/privacy}","received_events_url":"https://api.github.com/users/uber/received_events","type":"Organization","site_admin":false},"repo":{"id":137539238,"node_id":"MDEwOlJlcG9zaXRvcnkxMzc1MzkyMzg=","name":"petastorm","full_name":"uber/petastorm","private":false,"owner":{"login":"uber","id":538264,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUzODI2NA==","avatar_url":"https://avatars3.githubusercontent.com/u/538264?v=4","gravatar_id":"","url":"https://api.github.com/users/uber","html_url":"https://github.com/uber","followers_url":"https://api.github.com/users/uber/followers","following_url":"https://api.github.com/users/uber/following{/other_user}","gists_url":"https://api.github.com/users/uber/gists{/gist_id}","starred_url":"https://api.github.com/users/uber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uber/subscriptions","organizations_url":"https://api.github.com/users/uber/orgs","repos_url":"https://api.github.com/users/uber/repos","events_url":"https://api.github.com/users/uber/events{/privacy}","received_events_url":"https://api.github.com/users/uber/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/uber/petastorm","description":"Petastorm library enables single machine or distributed training and evaluation of deep learning models from datasets in Apache Parquet format. It supports ML frameworks such as Tensorflow, Pytorch, and PySpark and can be used from pure Python code.","fork":false,"url":"https://api.github.com/repos/uber/petastorm","forks_url":"https://api.github.com/repos/uber/petastorm/forks","keys_url":"https://api.github.com/repos/uber/petastorm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/uber/petastorm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/uber/petastorm/teams","hooks_url":"https://api.github.com/repos/uber/petastorm/hooks","issue_events_url":"https://api.github.com/repos/uber/petastorm/issues/events{/number}","events_url":"https://api.github.com/repos/uber/petastorm/events","assignees_url":"https://api.github.com/repos/uber/petastorm/assignees{/user}","branches_url":"https://api.github.com/repos/uber/petastorm/branches{/branch}","tags_url":"https://api.github.com/repos/uber/petastorm/tags","blobs_url":"https://api.github.com/repos/uber/petastorm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/uber/petastorm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/uber/petastorm/git/refs{/sha}","trees_url":"https://api.github.com/repos/uber/petastorm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/uber/petastorm/statuses/{sha}","languages_url":"https://api.github.com/repos/uber/petastorm/languages","stargazers_url":"https://api.github.com/repos/uber/petastorm/stargazers","contributors_url":"https://api.github.com/repos/uber/petastorm/contributors","subscribers_url":"https://api.github.com/repos/uber/petastorm/subscribers","subscription_url":"https://api.github.com/repos/uber/petastorm/subscription","commits_url":"https://api.github.com/repos/uber/petastorm/commits{/sha}","git_commits_url":"https://api.github.com/repos/uber/petastorm/git/commits{/sha}","comments_url":"https://api.github.com/repos/uber/petastorm/comments{/number}","issue_comment_url":"https://api.github.com/repos/uber/petastorm/issues/comments{/number}","contents_url":"https://api.github.com/repos/uber/petastorm/contents/{+path}","compare_url":"https://api.github.com/repos/uber/petastorm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/uber/petastorm/merges","archive_url":"https://api.github.com/repos/uber/petastorm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/uber/petastorm/downloads","issues_url":"https://api.github.com/repos/uber/petastorm/issues{/number}","pulls_url":"https://api.github.com/repos/uber/petastorm/pulls{/number}","milestones_url":"https://api.github.com/repos/uber/petastorm/milestones{/number}","notifications_url":"https://api.github.com/repos/uber/petastorm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/uber/petastorm/labels{/name}","releases_url":"https://api.github.com/repos/uber/petastorm/releases{/id}","deployments_url":"https://api.github.com/repos/uber/petastorm/deployments","created_at":"2018-06-15T23:15:29Z","updated_at":"2018-09-27T18:55:10Z","pushed_at":"2018-09-27T21:11:23Z","git_url":"git://github.com/uber/petastorm.git","ssh_url":"git@github.com:uber/petastorm.git","clone_url":"https://github.com/uber/petastorm.git","svn_url":"https://github.com/uber/petastorm","homepage":"","size":558,"stargazers_count":191,"watchers_count":191,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":29,"mirror_url":null,"archived":false,"open_issues_count":39,"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":29,"open_issues":39,"watchers":191,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/uber/petastorm/pulls/188"},"html":{"href":"https://github.com/uber/petastorm/pull/188"},"issue":{"href":"https://api.github.com/repos/uber/petastorm/issues/188"},"comments":{"href":"https://api.github.com/repos/uber/petastorm/issues/188/comments"},"review_comments":{"href":"https://api.github.com/repos/uber/petastorm/pulls/188/comments"},"review_comment":{"href":"https://api.github.com/repos/uber/petastorm/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/uber/petastorm/pulls/188/commits"},"statuses":{"href":"https://api.github.com/repos/uber/petastorm/statuses/bd094ada14fccaf1d5db0535b9e6100deedb735e"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"selitvin"}}