{"action":"created","comment":{"url":"https://api.github.com/repos/blaze/blaze/pulls/comments/52705365","id":52705365,"diff_hunk":"@@ -842,6 +842,24 @@ def compute_up(t, s, **kwargs):\n     return s.order_by(*cols)\n \n \n+@dispatch(Sample, sa.Table)\n+def compute_up(t, s, **kwargs):\n+    n = t.n if t.n is not None else int(t.frac * s.count().scalar())","path":"blaze/compute/sql.py","position":19,"original_position":19,"commit_id":"b9346141ac38e4b309a485f9613d8709f7ea6fca","original_commit_id":"b9346141ac38e4b309a485f9613d8709f7ea6fca","user":{"login":"llllllllll","id":3064397,"avatar_url":"https://avatars.githubusercontent.com/u/3064397?v=3","gravatar_id":"","url":"https://api.github.com/users/llllllllll","html_url":"https://github.com/llllllllll","followers_url":"https://api.github.com/users/llllllllll/followers","following_url":"https://api.github.com/users/llllllllll/following{/other_user}","gists_url":"https://api.github.com/users/llllllllll/gists{/gist_id}","starred_url":"https://api.github.com/users/llllllllll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/llllllllll/subscriptions","organizations_url":"https://api.github.com/users/llllllllll/orgs","repos_url":"https://api.github.com/users/llllllllll/repos","events_url":"https://api.github.com/users/llllllllll/events{/privacy}","received_events_url":"https://api.github.com/users/llllllllll/received_events","type":"User","site_admin":false},"body":"This is going to actually execute a sql query at this point when you call `.scalar()`. Can we look into pushing this into a subselect to reduce the IO overhead. Also, should we special case postgres>=9.5 wich has the TABLESAMPLE clause on selects?","created_at":"2016-02-12T04:50:14Z","updated_at":"2016-02-12T04:50:14Z","html_url":"https://github.com/blaze/blaze/pull/1410#discussion_r52705365","pull_request_url":"https://api.github.com/repos/blaze/blaze/pulls/1410","_links":{"self":{"href":"https://api.github.com/repos/blaze/blaze/pulls/comments/52705365"},"html":{"href":"https://github.com/blaze/blaze/pull/1410#discussion_r52705365"},"pull_request":{"href":"https://api.github.com/repos/blaze/blaze/pulls/1410"}}},"pull_request":{"url":"https://api.github.com/repos/blaze/blaze/pulls/1410","id":58820471,"html_url":"https://github.com/blaze/blaze/pull/1410","diff_url":"https://github.com/blaze/blaze/pull/1410.diff","patch_url":"https://github.com/blaze/blaze/pull/1410.patch","issue_url":"https://api.github.com/repos/blaze/blaze/issues/1410","number":1410,"state":"open","locked":false,"title":"Random sampling","user":{"login":"kwmsmith","id":288771,"avatar_url":"https://avatars.githubusercontent.com/u/288771?v=3","gravatar_id":"","url":"https://api.github.com/users/kwmsmith","html_url":"https://github.com/kwmsmith","followers_url":"https://api.github.com/users/kwmsmith/followers","following_url":"https://api.github.com/users/kwmsmith/following{/other_user}","gists_url":"https://api.github.com/users/kwmsmith/gists{/gist_id}","starred_url":"https://api.github.com/users/kwmsmith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kwmsmith/subscriptions","organizations_url":"https://api.github.com/users/kwmsmith/orgs","repos_url":"https://api.github.com/users/kwmsmith/repos","events_url":"https://api.github.com/users/kwmsmith/events{/privacy}","received_events_url":"https://api.github.com/users/kwmsmith/received_events","type":"User","site_admin":false},"body":"Mimics Pandas' `df.sample()` interface.\r\n\r\nThe main usecase is to randomly downsample to a cached dataset, and then use that as the basis for faster exploration and expression building.\r\n\r\nSo far, the Python and SQL backends are implemented; still have to implement the Pandas / Dask backend.","created_at":"2016-02-09T22:39:32Z","updated_at":"2016-02-12T04:50:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7b5c93d845027ba4298db654d21fe5709e10d11a","assignee":null,"milestone":{"url":"https://api.github.com/repos/blaze/blaze/milestones/15","html_url":"https://github.com/blaze/blaze/milestones/0.10","labels_url":"https://api.github.com/repos/blaze/blaze/milestones/15/labels","id":1497597,"number":15,"title":"0.10","description":"","creator":{"login":"kwmsmith","id":288771,"avatar_url":"https://avatars.githubusercontent.com/u/288771?v=3","gravatar_id":"","url":"https://api.github.com/users/kwmsmith","html_url":"https://github.com/kwmsmith","followers_url":"https://api.github.com/users/kwmsmith/followers","following_url":"https://api.github.com/users/kwmsmith/following{/other_user}","gists_url":"https://api.github.com/users/kwmsmith/gists{/gist_id}","starred_url":"https://api.github.com/users/kwmsmith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kwmsmith/subscriptions","organizations_url":"https://api.github.com/users/kwmsmith/orgs","repos_url":"https://api.github.com/users/kwmsmith/repos","events_url":"https://api.github.com/users/kwmsmith/events{/privacy}","received_events_url":"https://api.github.com/users/kwmsmith/received_events","type":"User","site_admin":false},"open_issues":46,"closed_issues":4,"state":"open","created_at":"2016-01-11T16:03:15Z","updated_at":"2016-02-11T21:24:19Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/blaze/blaze/pulls/1410/commits","review_comments_url":"https://api.github.com/repos/blaze/blaze/pulls/1410/comments","review_comment_url":"https://api.github.com/repos/blaze/blaze/pulls/comments{/number}","comments_url":"https://api.github.com/repos/blaze/blaze/issues/1410/comments","statuses_url":"https://api.github.com/repos/blaze/blaze/statuses/b9346141ac38e4b309a485f9613d8709f7ea6fca","head":{"label":"kwmsmith:feature/sampling","ref":"feature/sampling","sha":"b9346141ac38e4b309a485f9613d8709f7ea6fca","user":{"login":"kwmsmith","id":288771,"avatar_url":"https://avatars.githubusercontent.com/u/288771?v=3","gravatar_id":"","url":"https://api.github.com/users/kwmsmith","html_url":"https://github.com/kwmsmith","followers_url":"https://api.github.com/users/kwmsmith/followers","following_url":"https://api.github.com/users/kwmsmith/following{/other_user}","gists_url":"https://api.github.com/users/kwmsmith/gists{/gist_id}","starred_url":"https://api.github.com/users/kwmsmith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kwmsmith/subscriptions","organizations_url":"https://api.github.com/users/kwmsmith/orgs","repos_url":"https://api.github.com/users/kwmsmith/repos","events_url":"https://api.github.com/users/kwmsmith/events{/privacy}","received_events_url":"https://api.github.com/users/kwmsmith/received_events","type":"User","site_admin":false},"repo":{"id":44128239,"name":"blaze","full_name":"kwmsmith/blaze","owner":{"login":"kwmsmith","id":288771,"avatar_url":"https://avatars.githubusercontent.com/u/288771?v=3","gravatar_id":"","url":"https://api.github.com/users/kwmsmith","html_url":"https://github.com/kwmsmith","followers_url":"https://api.github.com/users/kwmsmith/followers","following_url":"https://api.github.com/users/kwmsmith/following{/other_user}","gists_url":"https://api.github.com/users/kwmsmith/gists{/gist_id}","starred_url":"https://api.github.com/users/kwmsmith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kwmsmith/subscriptions","organizations_url":"https://api.github.com/users/kwmsmith/orgs","repos_url":"https://api.github.com/users/kwmsmith/repos","events_url":"https://api.github.com/users/kwmsmith/events{/privacy}","received_events_url":"https://api.github.com/users/kwmsmith/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kwmsmith/blaze","description":"NumPy and Pandas interface to Big Data","fork":true,"url":"https://api.github.com/repos/kwmsmith/blaze","forks_url":"https://api.github.com/repos/kwmsmith/blaze/forks","keys_url":"https://api.github.com/repos/kwmsmith/blaze/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kwmsmith/blaze/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kwmsmith/blaze/teams","hooks_url":"https://api.github.com/repos/kwmsmith/blaze/hooks","issue_events_url":"https://api.github.com/repos/kwmsmith/blaze/issues/events{/number}","events_url":"https://api.github.com/repos/kwmsmith/blaze/events","assignees_url":"https://api.github.com/repos/kwmsmith/blaze/assignees{/user}","branches_url":"https://api.github.com/repos/kwmsmith/blaze/branches{/branch}","tags_url":"https://api.github.com/repos/kwmsmith/blaze/tags","blobs_url":"https://api.github.com/repos/kwmsmith/blaze/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kwmsmith/blaze/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kwmsmith/blaze/git/refs{/sha}","trees_url":"https://api.github.com/repos/kwmsmith/blaze/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kwmsmith/blaze/statuses/{sha}","languages_url":"https://api.github.com/repos/kwmsmith/blaze/languages","stargazers_url":"https://api.github.com/repos/kwmsmith/blaze/stargazers","contributors_url":"https://api.github.com/repos/kwmsmith/blaze/contributors","subscribers_url":"https://api.github.com/repos/kwmsmith/blaze/subscribers","subscription_url":"https://api.github.com/repos/kwmsmith/blaze/subscription","commits_url":"https://api.github.com/repos/kwmsmith/blaze/commits{/sha}","git_commits_url":"https://api.github.com/repos/kwmsmith/blaze/git/commits{/sha}","comments_url":"https://api.github.com/repos/kwmsmith/blaze/comments{/number}","issue_comment_url":"https://api.github.com/repos/kwmsmith/blaze/issues/comments{/number}","contents_url":"https://api.github.com/repos/kwmsmith/blaze/contents/{+path}","compare_url":"https://api.github.com/repos/kwmsmith/blaze/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kwmsmith/blaze/merges","archive_url":"https://api.github.com/repos/kwmsmith/blaze/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kwmsmith/blaze/downloads","issues_url":"https://api.github.com/repos/kwmsmith/blaze/issues{/number}","pulls_url":"https://api.github.com/repos/kwmsmith/blaze/pulls{/number}","milestones_url":"https://api.github.com/repos/kwmsmith/blaze/milestones{/number}","notifications_url":"https://api.github.com/repos/kwmsmith/blaze/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kwmsmith/blaze/labels{/name}","releases_url":"https://api.github.com/repos/kwmsmith/blaze/releases{/id}","deployments_url":"https://api.github.com/repos/kwmsmith/blaze/deployments","created_at":"2015-10-12T19:07:37Z","updated_at":"2015-10-12T19:07:40Z","pushed_at":"2016-02-10T21:03:54Z","git_url":"git://github.com/kwmsmith/blaze.git","ssh_url":"git@github.com:kwmsmith/blaze.git","clone_url":"https://github.com/kwmsmith/blaze.git","svn_url":"https://github.com/kwmsmith/blaze","homepage":"blaze.pydata.org","size":22120,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"blaze:master","ref":"master","sha":"1d191d6e5ec40c7ef6ef40558b08f52d5a138bfc","user":{"login":"blaze","id":12833921,"avatar_url":"https://avatars.githubusercontent.com/u/12833921?v=3","gravatar_id":"","url":"https://api.github.com/users/blaze","html_url":"https://github.com/blaze","followers_url":"https://api.github.com/users/blaze/followers","following_url":"https://api.github.com/users/blaze/following{/other_user}","gists_url":"https://api.github.com/users/blaze/gists{/gist_id}","starred_url":"https://api.github.com/users/blaze/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blaze/subscriptions","organizations_url":"https://api.github.com/users/blaze/orgs","repos_url":"https://api.github.com/users/blaze/repos","events_url":"https://api.github.com/users/blaze/events{/privacy}","received_events_url":"https://api.github.com/users/blaze/received_events","type":"Organization","site_admin":false},"repo":{"id":6404963,"name":"blaze","full_name":"blaze/blaze","owner":{"login":"blaze","id":12833921,"avatar_url":"https://avatars.githubusercontent.com/u/12833921?v=3","gravatar_id":"","url":"https://api.github.com/users/blaze","html_url":"https://github.com/blaze","followers_url":"https://api.github.com/users/blaze/followers","following_url":"https://api.github.com/users/blaze/following{/other_user}","gists_url":"https://api.github.com/users/blaze/gists{/gist_id}","starred_url":"https://api.github.com/users/blaze/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blaze/subscriptions","organizations_url":"https://api.github.com/users/blaze/orgs","repos_url":"https://api.github.com/users/blaze/repos","events_url":"https://api.github.com/users/blaze/events{/privacy}","received_events_url":"https://api.github.com/users/blaze/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/blaze/blaze","description":"NumPy and Pandas interface to Big Data","fork":false,"url":"https://api.github.com/repos/blaze/blaze","forks_url":"https://api.github.com/repos/blaze/blaze/forks","keys_url":"https://api.github.com/repos/blaze/blaze/keys{/key_id}","collaborators_url":"https://api.github.com/repos/blaze/blaze/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/blaze/blaze/teams","hooks_url":"https://api.github.com/repos/blaze/blaze/hooks","issue_events_url":"https://api.github.com/repos/blaze/blaze/issues/events{/number}","events_url":"https://api.github.com/repos/blaze/blaze/events","assignees_url":"https://api.github.com/repos/blaze/blaze/assignees{/user}","branches_url":"https://api.github.com/repos/blaze/blaze/branches{/branch}","tags_url":"https://api.github.com/repos/blaze/blaze/tags","blobs_url":"https://api.github.com/repos/blaze/blaze/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/blaze/blaze/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/blaze/blaze/git/refs{/sha}","trees_url":"https://api.github.com/repos/blaze/blaze/git/trees{/sha}","statuses_url":"https://api.github.com/repos/blaze/blaze/statuses/{sha}","languages_url":"https://api.github.com/repos/blaze/blaze/languages","stargazers_url":"https://api.github.com/repos/blaze/blaze/stargazers","contributors_url":"https://api.github.com/repos/blaze/blaze/contributors","subscribers_url":"https://api.github.com/repos/blaze/blaze/subscribers","subscription_url":"https://api.github.com/repos/blaze/blaze/subscription","commits_url":"https://api.github.com/repos/blaze/blaze/commits{/sha}","git_commits_url":"https://api.github.com/repos/blaze/blaze/git/commits{/sha}","comments_url":"https://api.github.com/repos/blaze/blaze/comments{/number}","issue_comment_url":"https://api.github.com/repos/blaze/blaze/issues/comments{/number}","contents_url":"https://api.github.com/repos/blaze/blaze/contents/{+path}","compare_url":"https://api.github.com/repos/blaze/blaze/compare/{base}...{head}","merges_url":"https://api.github.com/repos/blaze/blaze/merges","archive_url":"https://api.github.com/repos/blaze/blaze/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/blaze/blaze/downloads","issues_url":"https://api.github.com/repos/blaze/blaze/issues{/number}","pulls_url":"https://api.github.com/repos/blaze/blaze/pulls{/number}","milestones_url":"https://api.github.com/repos/blaze/blaze/milestones{/number}","notifications_url":"https://api.github.com/repos/blaze/blaze/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/blaze/blaze/labels{/name}","releases_url":"https://api.github.com/repos/blaze/blaze/releases{/id}","deployments_url":"https://api.github.com/repos/blaze/blaze/deployments","created_at":"2012-10-26T14:25:22Z","updated_at":"2016-02-11T12:03:49Z","pushed_at":"2016-02-12T04:44:08Z","git_url":"git://github.com/blaze/blaze.git","ssh_url":"git@github.com:blaze/blaze.git","clone_url":"https://github.com/blaze/blaze.git","svn_url":"https://github.com/blaze/blaze","homepage":"blaze.pydata.org","size":27306,"stargazers_count":1371,"watchers_count":1371,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":200,"mirror_url":null,"open_issues_count":162,"forks":200,"open_issues":162,"watchers":1371,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/blaze/blaze/pulls/1410"},"html":{"href":"https://github.com/blaze/blaze/pull/1410"},"issue":{"href":"https://api.github.com/repos/blaze/blaze/issues/1410"},"comments":{"href":"https://api.github.com/repos/blaze/blaze/issues/1410/comments"},"review_comments":{"href":"https://api.github.com/repos/blaze/blaze/pulls/1410/comments"},"review_comment":{"href":"https://api.github.com/repos/blaze/blaze/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/blaze/blaze/pulls/1410/commits"},"statuses":{"href":"https://api.github.com/repos/blaze/blaze/statuses/b9346141ac38e4b309a485f9613d8709f7ea6fca"}}}}