{"action":"created","comment":{"url":"https://api.github.com/repos/crate/crate/pulls/comments/67098896","id":67098896,"diff_hunk":"@@ -168,59 +166,77 @@ public Plan planCopyFrom(CopyFromAnalyzedStatement analysis, Planner.Context con\n \n         DiscoveryNodes allNodes = clusterService.state().nodes();\n         FileUriCollectPhase collectPhase = new FileUriCollectPhase(\n-                context.jobId(),\n-                context.nextExecutionPhaseId(),\n-                \"copyFrom\",\n-                getExecutionNodes(allNodes, analysis.settings().getAsInt(\"num_readers\", allNodes.getSize()), analysis.nodePredicate()),\n-                analysis.uri(),\n-                toCollect,\n-                projections,\n-                analysis.settings().get(\"compression\", null),\n-                analysis.settings().getAsBoolean(\"shared\", null)\n+            context.jobId(),\n+            context.nextExecutionPhaseId(),\n+            \"copyFrom\",\n+            getExecutionNodes(allNodes, analysis.settings().getAsInt(\"num_readers\", allNodes.getSize()), analysis.nodePredicate()),\n+            analysis.uri(),\n+            toCollect,\n+            projections,\n+            analysis.settings().get(\"compression\", null),\n+            analysis.settings().getAsBoolean(\"shared\", null)\n         );\n \n         return new CollectAndMerge(collectPhase, MergePhase.localMerge(\n-                context.jobId(),\n-                context.nextExecutionPhaseId(),\n-                ImmutableList.<Projection>of(MergeCountProjection.INSTANCE),\n-                collectPhase.executionNodes().size(),\n-                collectPhase.outputTypes()));\n+            context.jobId(),\n+            context.nextExecutionPhaseId(),\n+            ImmutableList.<Projection>of(MergeCountProjection.INSTANCE),\n+            collectPhase.executionNodes().size(),\n+            collectPhase.outputTypes()));\n     }\n \n     public Plan planCopyTo(CopyToAnalyzedStatement statement, Planner.Context context) {\n         WriterProjection.OutputFormat outputFormat = statement.outputFormat();\n         if (outputFormat == null) {\n             outputFormat = statement.columnsDefined() ?\n-                    WriterProjection.OutputFormat.JSON_ARRAY : WriterProjection.OutputFormat.JSON_OBJECT;\n+                WriterProjection.OutputFormat.JSON_ARRAY : WriterProjection.OutputFormat.JSON_OBJECT;\n         }\n \n         WriterProjection projection = ProjectionBuilder.writerProjection(\n-                statement.subQueryRelation().querySpec().outputs(),\n-                statement.uri(),\n-                statement.isDirectoryUri(),\n-                statement.compressionType(),\n-                statement.overwrites(),\n-                statement.outputNames(),\n-                outputFormat);\n+            statement.subQueryRelation().querySpec().outputs(),\n+            statement.uri(),\n+            statement.isDirectoryUri(),\n+            statement.compressionType(),\n+            statement.overwrites(),\n+            statement.outputNames(),\n+            outputFormat);\n \n         PlannedAnalyzedRelation plannedSubQuery = context.planSubRelation(statement.subQueryRelation(),\n-                new ConsumerContext(statement, context));\n+            new ConsumerContext(statement, context));\n         if (plannedSubQuery == null) {\n             return null;\n         }\n \n+        if (!statement.isDirectoryUri()) {\n+            checkNodeShards(plannedSubQuery);","path":"sql/src/main/java/io/crate/planner/statement/CopyStatementPlanner.java","position":140,"original_position":140,"commit_id":"ea194786860af6f8547dd5d7d92ed6067c3d8441","original_commit_id":"ea194786860af6f8547dd5d7d92ed6067c3d8441","user":{"login":"dobe","id":48020,"avatar_url":"https://avatars.githubusercontent.com/u/48020?v=3","gravatar_id":"","url":"https://api.github.com/users/dobe","html_url":"https://github.com/dobe","followers_url":"https://api.github.com/users/dobe/followers","following_url":"https://api.github.com/users/dobe/following{/other_user}","gists_url":"https://api.github.com/users/dobe/gists{/gist_id}","starred_url":"https://api.github.com/users/dobe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dobe/subscriptions","organizations_url":"https://api.github.com/users/dobe/orgs","repos_url":"https://api.github.com/users/dobe/repos","events_url":"https://api.github.com/users/dobe/events{/privacy}","received_events_url":"https://api.github.com/users/dobe/received_events","type":"User","site_admin":false},"body":"there should be a check for shard granularity expression first?","created_at":"2016-06-15T04:43:08Z","updated_at":"2016-06-15T04:43:08Z","html_url":"https://github.com/crate/crate/pull/3637#discussion_r67098896","pull_request_url":"https://api.github.com/repos/crate/crate/pulls/3637","_links":{"self":{"href":"https://api.github.com/repos/crate/crate/pulls/comments/67098896"},"html":{"href":"https://github.com/crate/crate/pull/3637#discussion_r67098896"},"pull_request":{"href":"https://api.github.com/repos/crate/crate/pulls/3637"}}},"pull_request":{"url":"https://api.github.com/repos/crate/crate/pulls/3637","id":73772706,"html_url":"https://github.com/crate/crate/pull/3637","diff_url":"https://github.com/crate/crate/pull/3637.diff","patch_url":"https://github.com/crate/crate/pull/3637.patch","issue_url":"https://api.github.com/repos/crate/crate/issues/3637","number":3637,"state":"open","locked":false,"title":"Avoid creation of corrupt file on COPY TO","user":{"login":"aelesbao","id":466801,"avatar_url":"https://avatars.githubusercontent.com/u/466801?v=3","gravatar_id":"","url":"https://api.github.com/users/aelesbao","html_url":"https://github.com/aelesbao","followers_url":"https://api.github.com/users/aelesbao/followers","following_url":"https://api.github.com/users/aelesbao/following{/other_user}","gists_url":"https://api.github.com/users/aelesbao/gists{/gist_id}","starred_url":"https://api.github.com/users/aelesbao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aelesbao/subscriptions","organizations_url":"https://api.github.com/users/aelesbao/orgs","repos_url":"https://api.github.com/users/aelesbao/repos","events_url":"https://api.github.com/users/aelesbao/events{/privacy}","received_events_url":"https://api.github.com/users/aelesbao/received_events","type":"User","site_admin":false},"body":"Prevent user from defining output paths which conflict with multiple\nshards.","created_at":"2016-06-14T16:34:34Z","updated_at":"2016-06-15T04:43:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b94b36051adbcf918bcd3de849179def16b8a506","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/crate/crate/pulls/3637/commits","review_comments_url":"https://api.github.com/repos/crate/crate/pulls/3637/comments","review_comment_url":"https://api.github.com/repos/crate/crate/pulls/comments{/number}","comments_url":"https://api.github.com/repos/crate/crate/issues/3637/comments","statuses_url":"https://api.github.com/repos/crate/crate/statuses/ea194786860af6f8547dd5d7d92ed6067c3d8441","head":{"label":"crate:a/detect-copy-to-on-shard","ref":"a/detect-copy-to-on-shard","sha":"ea194786860af6f8547dd5d7d92ed6067c3d8441","user":{"login":"crate","id":4048232,"avatar_url":"https://avatars.githubusercontent.com/u/4048232?v=3","gravatar_id":"","url":"https://api.github.com/users/crate","html_url":"https://github.com/crate","followers_url":"https://api.github.com/users/crate/followers","following_url":"https://api.github.com/users/crate/following{/other_user}","gists_url":"https://api.github.com/users/crate/gists{/gist_id}","starred_url":"https://api.github.com/users/crate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crate/subscriptions","organizations_url":"https://api.github.com/users/crate/orgs","repos_url":"https://api.github.com/users/crate/repos","events_url":"https://api.github.com/users/crate/events{/privacy}","received_events_url":"https://api.github.com/users/crate/received_events","type":"Organization","site_admin":false},"repo":{"id":9342529,"name":"crate","full_name":"crate/crate","owner":{"login":"crate","id":4048232,"avatar_url":"https://avatars.githubusercontent.com/u/4048232?v=3","gravatar_id":"","url":"https://api.github.com/users/crate","html_url":"https://github.com/crate","followers_url":"https://api.github.com/users/crate/followers","following_url":"https://api.github.com/users/crate/following{/other_user}","gists_url":"https://api.github.com/users/crate/gists{/gist_id}","starred_url":"https://api.github.com/users/crate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crate/subscriptions","organizations_url":"https://api.github.com/users/crate/orgs","repos_url":"https://api.github.com/users/crate/repos","events_url":"https://api.github.com/users/crate/events{/privacy}","received_events_url":"https://api.github.com/users/crate/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/crate/crate","description":"Crate.IO: The fast, scalable, easy to use SQL database with native full text search","fork":false,"url":"https://api.github.com/repos/crate/crate","forks_url":"https://api.github.com/repos/crate/crate/forks","keys_url":"https://api.github.com/repos/crate/crate/keys{/key_id}","collaborators_url":"https://api.github.com/repos/crate/crate/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/crate/crate/teams","hooks_url":"https://api.github.com/repos/crate/crate/hooks","issue_events_url":"https://api.github.com/repos/crate/crate/issues/events{/number}","events_url":"https://api.github.com/repos/crate/crate/events","assignees_url":"https://api.github.com/repos/crate/crate/assignees{/user}","branches_url":"https://api.github.com/repos/crate/crate/branches{/branch}","tags_url":"https://api.github.com/repos/crate/crate/tags","blobs_url":"https://api.github.com/repos/crate/crate/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/crate/crate/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/crate/crate/git/refs{/sha}","trees_url":"https://api.github.com/repos/crate/crate/git/trees{/sha}","statuses_url":"https://api.github.com/repos/crate/crate/statuses/{sha}","languages_url":"https://api.github.com/repos/crate/crate/languages","stargazers_url":"https://api.github.com/repos/crate/crate/stargazers","contributors_url":"https://api.github.com/repos/crate/crate/contributors","subscribers_url":"https://api.github.com/repos/crate/crate/subscribers","subscription_url":"https://api.github.com/repos/crate/crate/subscription","commits_url":"https://api.github.com/repos/crate/crate/commits{/sha}","git_commits_url":"https://api.github.com/repos/crate/crate/git/commits{/sha}","comments_url":"https://api.github.com/repos/crate/crate/comments{/number}","issue_comment_url":"https://api.github.com/repos/crate/crate/issues/comments{/number}","contents_url":"https://api.github.com/repos/crate/crate/contents/{+path}","compare_url":"https://api.github.com/repos/crate/crate/compare/{base}...{head}","merges_url":"https://api.github.com/repos/crate/crate/merges","archive_url":"https://api.github.com/repos/crate/crate/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/crate/crate/downloads","issues_url":"https://api.github.com/repos/crate/crate/issues{/number}","pulls_url":"https://api.github.com/repos/crate/crate/pulls{/number}","milestones_url":"https://api.github.com/repos/crate/crate/milestones{/number}","notifications_url":"https://api.github.com/repos/crate/crate/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/crate/crate/labels{/name}","releases_url":"https://api.github.com/repos/crate/crate/releases{/id}","deployments_url":"https://api.github.com/repos/crate/crate/deployments","created_at":"2013-04-10T09:17:16Z","updated_at":"2016-06-13T14:26:09Z","pushed_at":"2016-06-14T21:20:16Z","git_url":"git://github.com/crate/crate.git","ssh_url":"git@github.com:crate/crate.git","clone_url":"https://github.com/crate/crate.git","svn_url":"https://github.com/crate/crate","homepage":"https://crate.io","size":69927,"stargazers_count":1283,"watchers_count":1283,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":141,"mirror_url":null,"open_issues_count":45,"forks":141,"open_issues":45,"watchers":1283,"default_branch":"master"}},"base":{"label":"crate:master","ref":"master","sha":"4d3519171333163f4f7a848fc987e8e95263a659","user":{"login":"crate","id":4048232,"avatar_url":"https://avatars.githubusercontent.com/u/4048232?v=3","gravatar_id":"","url":"https://api.github.com/users/crate","html_url":"https://github.com/crate","followers_url":"https://api.github.com/users/crate/followers","following_url":"https://api.github.com/users/crate/following{/other_user}","gists_url":"https://api.github.com/users/crate/gists{/gist_id}","starred_url":"https://api.github.com/users/crate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crate/subscriptions","organizations_url":"https://api.github.com/users/crate/orgs","repos_url":"https://api.github.com/users/crate/repos","events_url":"https://api.github.com/users/crate/events{/privacy}","received_events_url":"https://api.github.com/users/crate/received_events","type":"Organization","site_admin":false},"repo":{"id":9342529,"name":"crate","full_name":"crate/crate","owner":{"login":"crate","id":4048232,"avatar_url":"https://avatars.githubusercontent.com/u/4048232?v=3","gravatar_id":"","url":"https://api.github.com/users/crate","html_url":"https://github.com/crate","followers_url":"https://api.github.com/users/crate/followers","following_url":"https://api.github.com/users/crate/following{/other_user}","gists_url":"https://api.github.com/users/crate/gists{/gist_id}","starred_url":"https://api.github.com/users/crate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crate/subscriptions","organizations_url":"https://api.github.com/users/crate/orgs","repos_url":"https://api.github.com/users/crate/repos","events_url":"https://api.github.com/users/crate/events{/privacy}","received_events_url":"https://api.github.com/users/crate/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/crate/crate","description":"Crate.IO: The fast, scalable, easy to use SQL database with native full text search","fork":false,"url":"https://api.github.com/repos/crate/crate","forks_url":"https://api.github.com/repos/crate/crate/forks","keys_url":"https://api.github.com/repos/crate/crate/keys{/key_id}","collaborators_url":"https://api.github.com/repos/crate/crate/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/crate/crate/teams","hooks_url":"https://api.github.com/repos/crate/crate/hooks","issue_events_url":"https://api.github.com/repos/crate/crate/issues/events{/number}","events_url":"https://api.github.com/repos/crate/crate/events","assignees_url":"https://api.github.com/repos/crate/crate/assignees{/user}","branches_url":"https://api.github.com/repos/crate/crate/branches{/branch}","tags_url":"https://api.github.com/repos/crate/crate/tags","blobs_url":"https://api.github.com/repos/crate/crate/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/crate/crate/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/crate/crate/git/refs{/sha}","trees_url":"https://api.github.com/repos/crate/crate/git/trees{/sha}","statuses_url":"https://api.github.com/repos/crate/crate/statuses/{sha}","languages_url":"https://api.github.com/repos/crate/crate/languages","stargazers_url":"https://api.github.com/repos/crate/crate/stargazers","contributors_url":"https://api.github.com/repos/crate/crate/contributors","subscribers_url":"https://api.github.com/repos/crate/crate/subscribers","subscription_url":"https://api.github.com/repos/crate/crate/subscription","commits_url":"https://api.github.com/repos/crate/crate/commits{/sha}","git_commits_url":"https://api.github.com/repos/crate/crate/git/commits{/sha}","comments_url":"https://api.github.com/repos/crate/crate/comments{/number}","issue_comment_url":"https://api.github.com/repos/crate/crate/issues/comments{/number}","contents_url":"https://api.github.com/repos/crate/crate/contents/{+path}","compare_url":"https://api.github.com/repos/crate/crate/compare/{base}...{head}","merges_url":"https://api.github.com/repos/crate/crate/merges","archive_url":"https://api.github.com/repos/crate/crate/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/crate/crate/downloads","issues_url":"https://api.github.com/repos/crate/crate/issues{/number}","pulls_url":"https://api.github.com/repos/crate/crate/pulls{/number}","milestones_url":"https://api.github.com/repos/crate/crate/milestones{/number}","notifications_url":"https://api.github.com/repos/crate/crate/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/crate/crate/labels{/name}","releases_url":"https://api.github.com/repos/crate/crate/releases{/id}","deployments_url":"https://api.github.com/repos/crate/crate/deployments","created_at":"2013-04-10T09:17:16Z","updated_at":"2016-06-13T14:26:09Z","pushed_at":"2016-06-14T21:20:16Z","git_url":"git://github.com/crate/crate.git","ssh_url":"git@github.com:crate/crate.git","clone_url":"https://github.com/crate/crate.git","svn_url":"https://github.com/crate/crate","homepage":"https://crate.io","size":69927,"stargazers_count":1283,"watchers_count":1283,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":141,"mirror_url":null,"open_issues_count":45,"forks":141,"open_issues":45,"watchers":1283,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/crate/crate/pulls/3637"},"html":{"href":"https://github.com/crate/crate/pull/3637"},"issue":{"href":"https://api.github.com/repos/crate/crate/issues/3637"},"comments":{"href":"https://api.github.com/repos/crate/crate/issues/3637/comments"},"review_comments":{"href":"https://api.github.com/repos/crate/crate/pulls/3637/comments"},"review_comment":{"href":"https://api.github.com/repos/crate/crate/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/crate/crate/pulls/3637/commits"},"statuses":{"href":"https://api.github.com/repos/crate/crate/statuses/ea194786860af6f8547dd5d7d92ed6067c3d8441"}}}}
{"actor":{"display_login":"dobe"}}