{"action":"created","issue":{"url":"https://api.github.com/repos/gpuopenanalytics/pygdf/issues/213","repository_url":"https://api.github.com/repos/gpuopenanalytics/pygdf","labels_url":"https://api.github.com/repos/gpuopenanalytics/pygdf/issues/213/labels{/name}","comments_url":"https://api.github.com/repos/gpuopenanalytics/pygdf/issues/213/comments","events_url":"https://api.github.com/repos/gpuopenanalytics/pygdf/issues/213/events","html_url":"https://github.com/gpuopenanalytics/pygdf/pull/213","id":352753204,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA5OTg3ODg5","number":213,"title":"[REVIEW] Feature/reflected ops","user":{"login":"beckernick","id":8457388,"node_id":"MDQ6VXNlcjg0NTczODg=","avatar_url":"https://avatars3.githubusercontent.com/u/8457388?v=4","gravatar_id":"","url":"https://api.github.com/users/beckernick","html_url":"https://github.com/beckernick","followers_url":"https://api.github.com/users/beckernick/followers","following_url":"https://api.github.com/users/beckernick/following{/other_user}","gists_url":"https://api.github.com/users/beckernick/gists{/gist_id}","starred_url":"https://api.github.com/users/beckernick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beckernick/subscriptions","organizations_url":"https://api.github.com/users/beckernick/orgs","repos_url":"https://api.github.com/users/beckernick/repos","events_url":"https://api.github.com/users/beckernick/events{/privacy}","received_events_url":"https://api.github.com/users/beckernick/received_events","type":"User","site_admin":false},"labels":[{"id":1013987503,"node_id":"MDU6TGFiZWwxMDEzOTg3NTAz","url":"https://api.github.com/repos/gpuopenanalytics/pygdf/labels/2%20-%20In%20Progress","name":"2 - In Progress","color":"fef2c0","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2018-08-22T00:02:58Z","updated_at":"2018-08-22T18:27:55Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/gpuopenanalytics/pygdf/pulls/213","html_url":"https://github.com/gpuopenanalytics/pygdf/pull/213","diff_url":"https://github.com/gpuopenanalytics/pygdf/pull/213.diff","patch_url":"https://github.com/gpuopenanalytics/pygdf/pull/213.patch"},"body":"This PR adds reflected operations for addition, multiplication, subtraction, true division, and floor division (and associated unit tests). [Reflected operations](https://docs.python.org/3.2/reference/datamodel.html#emulating-numeric-types) implement binary operations and are used when the left operand does not support the operation and is of a different type.\r\n\r\nCurrently, `__radd__` and `__rmul__` are implemented and passing tests.\r\n\r\nInitial placeholder versions of `__rsub__`, `__rtruediv`, and `__rfloordiv__` are implemented (the non-commutative operations). Instead of performing `left operand - right operand`, `left operand /  right operand`, etc., they perform `right operand - left operand`.\r\n\r\nImplementing the non-commutative operations may require defining and populating a `Series` of matching dimensions with each value being the scalar. A naive implementation that doesn't match the dimensions such as:\r\n```\r\ndef __rsub__(self, other):\r\n    if isinstance(other, (np.int32, np.float32, ...)):\r\n        other = Series(other)\r\n    return other.__sub__(self)\r\n````\r\nwill result in a `GDF_COLUMN_SIZE_MISMATCH` error when doing binary operations on Series of different sizes. \r\n\r\nThere's likely an approach leveraging some of the column ops like `column_empty_like` and `fillna`. I wiill test it and profile it, but I'm just not sure if it's optimal. I am happy to defer to @kkraus14, @scopatz, and others with more knowledge on what the right approach is for these non-commutative operations. \r\n\r\nThis PR closes #208. If/when this PR is merged, squash/merge may be the best idea as the commit history is a bit circular."},"comment":{"url":"https://api.github.com/repos/gpuopenanalytics/pygdf/issues/comments/415132407","html_url":"https://github.com/gpuopenanalytics/pygdf/pull/213#issuecomment-415132407","issue_url":"https://api.github.com/repos/gpuopenanalytics/pygdf/issues/213","id":415132407,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNTEzMjQwNw==","user":{"login":"scopatz","id":320553,"node_id":"MDQ6VXNlcjMyMDU1Mw==","avatar_url":"https://avatars2.githubusercontent.com/u/320553?v=4","gravatar_id":"","url":"https://api.github.com/users/scopatz","html_url":"https://github.com/scopatz","followers_url":"https://api.github.com/users/scopatz/followers","following_url":"https://api.github.com/users/scopatz/following{/other_user}","gists_url":"https://api.github.com/users/scopatz/gists{/gist_id}","starred_url":"https://api.github.com/users/scopatz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scopatz/subscriptions","organizations_url":"https://api.github.com/users/scopatz/orgs","repos_url":"https://api.github.com/users/scopatz/repos","events_url":"https://api.github.com/users/scopatz/events{/privacy}","received_events_url":"https://api.github.com/users/scopatz/received_events","type":"User","site_admin":false},"created_at":"2018-08-22T18:27:55Z","updated_at":"2018-08-22T18:27:55Z","author_association":"CONTRIBUTOR","body":"LGTM!"}}
{"actor":{"display_login":"scopatz"}}