{"action":"created","comment":{"url":"https://api.github.com/repos/apache/avro/pulls/comments/58734609","id":58734609,"diff_hunk":"@@ -341,6 +389,71 @@ def write_double(self, datum):\n     self.write(chr((bits >> 48) & 0xFF))\n     self.write(chr((bits >> 56) & 0xFF))\n \n+  def write_decimal_bytes(self, datum, scale):\n+    \"\"\"\n+    Decimal in bytes are encoded as long. Since size of packed value in bytes for\n+    signed long is 8, 8 bytes are written.\n+    \"\"\"\n+    sign, digits, exp = datum.as_tuple()\n+    if exp > scale:\n+      raise AvroTypeException('Scale provided in schema does not match the decimal')\n+\n+    unscaled_datum = 0\n+    for digit in digits:\n+      unscaled_datum = (unscaled_datum * 10) + digit\n+\n+    bits_req = unscaled_datum.bit_length()\n+    if sign:","path":"lang/py/src/avro/io.py","position":112,"original_position":112,"commit_id":"632bfa132b635e6c854982c8049b1a3891e9b8a8","original_commit_id":"632bfa132b635e6c854982c8049b1a3891e9b8a8","user":{"login":"mtth","id":1216372,"avatar_url":"https://avatars.githubusercontent.com/u/1216372?v=3","gravatar_id":"","url":"https://api.github.com/users/mtth","html_url":"https://github.com/mtth","followers_url":"https://api.github.com/users/mtth/followers","following_url":"https://api.github.com/users/mtth/following{/other_user}","gists_url":"https://api.github.com/users/mtth/gists{/gist_id}","starred_url":"https://api.github.com/users/mtth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mtth/subscriptions","organizations_url":"https://api.github.com/users/mtth/orgs","repos_url":"https://api.github.com/users/mtth/repos","events_url":"https://api.github.com/users/mtth/events{/privacy}","received_events_url":"https://api.github.com/users/mtth/received_events","type":"User","site_admin":false},"body":"The logic for handling the number of bytes used doesn't look correct. For example, `255` gets encoded as a single byte (when it should require two). I think you also need to make sure positive numbers have a `0` in the left-most bit (e.g. by removing line 407 and tweaking lines 410-414).","created_at":"2016-04-06T16:13:11Z","updated_at":"2016-04-06T16:13:11Z","html_url":"https://github.com/apache/avro/pull/82#discussion_r58734609","pull_request_url":"https://api.github.com/repos/apache/avro/pulls/82","_links":{"self":{"href":"https://api.github.com/repos/apache/avro/pulls/comments/58734609"},"html":{"href":"https://github.com/apache/avro/pull/82#discussion_r58734609"},"pull_request":{"href":"https://api.github.com/repos/apache/avro/pulls/82"}}},"pull_request":{"url":"https://api.github.com/repos/apache/avro/pulls/82","id":64354332,"html_url":"https://github.com/apache/avro/pull/82","diff_url":"https://github.com/apache/avro/pull/82.diff","patch_url":"https://github.com/apache/avro/pull/82.patch","issue_url":"https://api.github.com/repos/apache/avro/issues/82","number":82,"state":"open","locked":false,"title":"[AVRO-1816] Add support for logical decimal type for python AVRO","user":{"login":"premsantosh","id":1332635,"avatar_url":"https://avatars.githubusercontent.com/u/1332635?v=3","gravatar_id":"","url":"https://api.github.com/users/premsantosh","html_url":"https://github.com/premsantosh","followers_url":"https://api.github.com/users/premsantosh/followers","following_url":"https://api.github.com/users/premsantosh/following{/other_user}","gists_url":"https://api.github.com/users/premsantosh/gists{/gist_id}","starred_url":"https://api.github.com/users/premsantosh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/premsantosh/subscriptions","organizations_url":"https://api.github.com/users/premsantosh/orgs","repos_url":"https://api.github.com/users/premsantosh/repos","events_url":"https://api.github.com/users/premsantosh/events{/privacy}","received_events_url":"https://api.github.com/users/premsantosh/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-03-28T18:25:03Z","updated_at":"2016-04-06T16:13:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5072180459799186b1af2111bfb21d51d232edb3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/avro/pulls/82/commits","review_comments_url":"https://api.github.com/repos/apache/avro/pulls/82/comments","review_comment_url":"https://api.github.com/repos/apache/avro/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/avro/issues/82/comments","statuses_url":"https://api.github.com/repos/apache/avro/statuses/632bfa132b635e6c854982c8049b1a3891e9b8a8","head":{"label":"premsantosh:logical-decimal-type","ref":"logical-decimal-type","sha":"632bfa132b635e6c854982c8049b1a3891e9b8a8","user":{"login":"premsantosh","id":1332635,"avatar_url":"https://avatars.githubusercontent.com/u/1332635?v=3","gravatar_id":"","url":"https://api.github.com/users/premsantosh","html_url":"https://github.com/premsantosh","followers_url":"https://api.github.com/users/premsantosh/followers","following_url":"https://api.github.com/users/premsantosh/following{/other_user}","gists_url":"https://api.github.com/users/premsantosh/gists{/gist_id}","starred_url":"https://api.github.com/users/premsantosh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/premsantosh/subscriptions","organizations_url":"https://api.github.com/users/premsantosh/orgs","repos_url":"https://api.github.com/users/premsantosh/repos","events_url":"https://api.github.com/users/premsantosh/events{/privacy}","received_events_url":"https://api.github.com/users/premsantosh/received_events","type":"User","site_admin":false},"repo":{"id":54066600,"name":"avro","full_name":"premsantosh/avro","owner":{"login":"premsantosh","id":1332635,"avatar_url":"https://avatars.githubusercontent.com/u/1332635?v=3","gravatar_id":"","url":"https://api.github.com/users/premsantosh","html_url":"https://github.com/premsantosh","followers_url":"https://api.github.com/users/premsantosh/followers","following_url":"https://api.github.com/users/premsantosh/following{/other_user}","gists_url":"https://api.github.com/users/premsantosh/gists{/gist_id}","starred_url":"https://api.github.com/users/premsantosh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/premsantosh/subscriptions","organizations_url":"https://api.github.com/users/premsantosh/orgs","repos_url":"https://api.github.com/users/premsantosh/repos","events_url":"https://api.github.com/users/premsantosh/events{/privacy}","received_events_url":"https://api.github.com/users/premsantosh/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/premsantosh/avro","description":"Mirror of Apache Avro","fork":true,"url":"https://api.github.com/repos/premsantosh/avro","forks_url":"https://api.github.com/repos/premsantosh/avro/forks","keys_url":"https://api.github.com/repos/premsantosh/avro/keys{/key_id}","collaborators_url":"https://api.github.com/repos/premsantosh/avro/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/premsantosh/avro/teams","hooks_url":"https://api.github.com/repos/premsantosh/avro/hooks","issue_events_url":"https://api.github.com/repos/premsantosh/avro/issues/events{/number}","events_url":"https://api.github.com/repos/premsantosh/avro/events","assignees_url":"https://api.github.com/repos/premsantosh/avro/assignees{/user}","branches_url":"https://api.github.com/repos/premsantosh/avro/branches{/branch}","tags_url":"https://api.github.com/repos/premsantosh/avro/tags","blobs_url":"https://api.github.com/repos/premsantosh/avro/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/premsantosh/avro/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/premsantosh/avro/git/refs{/sha}","trees_url":"https://api.github.com/repos/premsantosh/avro/git/trees{/sha}","statuses_url":"https://api.github.com/repos/premsantosh/avro/statuses/{sha}","languages_url":"https://api.github.com/repos/premsantosh/avro/languages","stargazers_url":"https://api.github.com/repos/premsantosh/avro/stargazers","contributors_url":"https://api.github.com/repos/premsantosh/avro/contributors","subscribers_url":"https://api.github.com/repos/premsantosh/avro/subscribers","subscription_url":"https://api.github.com/repos/premsantosh/avro/subscription","commits_url":"https://api.github.com/repos/premsantosh/avro/commits{/sha}","git_commits_url":"https://api.github.com/repos/premsantosh/avro/git/commits{/sha}","comments_url":"https://api.github.com/repos/premsantosh/avro/comments{/number}","issue_comment_url":"https://api.github.com/repos/premsantosh/avro/issues/comments{/number}","contents_url":"https://api.github.com/repos/premsantosh/avro/contents/{+path}","compare_url":"https://api.github.com/repos/premsantosh/avro/compare/{base}...{head}","merges_url":"https://api.github.com/repos/premsantosh/avro/merges","archive_url":"https://api.github.com/repos/premsantosh/avro/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/premsantosh/avro/downloads","issues_url":"https://api.github.com/repos/premsantosh/avro/issues{/number}","pulls_url":"https://api.github.com/repos/premsantosh/avro/pulls{/number}","milestones_url":"https://api.github.com/repos/premsantosh/avro/milestones{/number}","notifications_url":"https://api.github.com/repos/premsantosh/avro/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/premsantosh/avro/labels{/name}","releases_url":"https://api.github.com/repos/premsantosh/avro/releases{/id}","deployments_url":"https://api.github.com/repos/premsantosh/avro/deployments","created_at":"2016-03-16T21:10:07Z","updated_at":"2016-03-16T21:10:11Z","pushed_at":"2016-04-05T20:16:24Z","git_url":"git://github.com/premsantosh/avro.git","ssh_url":"git@github.com:premsantosh/avro.git","clone_url":"https://github.com/premsantosh/avro.git","svn_url":"https://github.com/premsantosh/avro","homepage":null,"size":10151,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"482adcfa1857033f2a76b07b429a266b0231f433","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","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":206459,"name":"avro","full_name":"apache/avro","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","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/avro","description":"Mirror of Apache Avro","fork":false,"url":"https://api.github.com/repos/apache/avro","forks_url":"https://api.github.com/repos/apache/avro/forks","keys_url":"https://api.github.com/repos/apache/avro/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/avro/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/avro/teams","hooks_url":"https://api.github.com/repos/apache/avro/hooks","issue_events_url":"https://api.github.com/repos/apache/avro/issues/events{/number}","events_url":"https://api.github.com/repos/apache/avro/events","assignees_url":"https://api.github.com/repos/apache/avro/assignees{/user}","branches_url":"https://api.github.com/repos/apache/avro/branches{/branch}","tags_url":"https://api.github.com/repos/apache/avro/tags","blobs_url":"https://api.github.com/repos/apache/avro/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/avro/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/avro/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/avro/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/avro/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/avro/languages","stargazers_url":"https://api.github.com/repos/apache/avro/stargazers","contributors_url":"https://api.github.com/repos/apache/avro/contributors","subscribers_url":"https://api.github.com/repos/apache/avro/subscribers","subscription_url":"https://api.github.com/repos/apache/avro/subscription","commits_url":"https://api.github.com/repos/apache/avro/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/avro/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/avro/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/avro/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/avro/contents/{+path}","compare_url":"https://api.github.com/repos/apache/avro/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/avro/merges","archive_url":"https://api.github.com/repos/apache/avro/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/avro/downloads","issues_url":"https://api.github.com/repos/apache/avro/issues{/number}","pulls_url":"https://api.github.com/repos/apache/avro/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/avro/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/avro/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/avro/labels{/name}","releases_url":"https://api.github.com/repos/apache/avro/releases{/id}","deployments_url":"https://api.github.com/repos/apache/avro/deployments","created_at":"2009-05-21T02:48:37Z","updated_at":"2016-04-06T10:58:23Z","pushed_at":"2016-04-06T14:52:55Z","git_url":"git://github.com/apache/avro.git","ssh_url":"git@github.com:apache/avro.git","clone_url":"https://github.com/apache/avro.git","svn_url":"https://github.com/apache/avro","homepage":null,"size":11626,"stargazers_count":451,"watchers_count":451,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":324,"mirror_url":"git://git.apache.org/avro.git","open_issues_count":16,"forks":324,"open_issues":16,"watchers":451,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/avro/pulls/82"},"html":{"href":"https://github.com/apache/avro/pull/82"},"issue":{"href":"https://api.github.com/repos/apache/avro/issues/82"},"comments":{"href":"https://api.github.com/repos/apache/avro/issues/82/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/avro/pulls/82/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/avro/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/avro/pulls/82/commits"},"statuses":{"href":"https://api.github.com/repos/apache/avro/statuses/632bfa132b635e6c854982c8049b1a3891e9b8a8"}}}}