{"action":"created","comment":{"url":"https://api.github.com/repos/pivotalsoftware/quickstep/pulls/comments/55890530","id":55890530,"diff_hunk":"@@ -760,16 +760,59 @@ void ExecutionGenerator::convertCreateIndex(\n   // CreateIndex is converted to a CreateIndex operator.\n   const CatalogRelationInfo *input_relation_info =\n       findRelationInfoOutputByPhysical(physical_plan->input());\n+  // NOTE: the object pointed to by input_relation is owned by CatalogRelation\n   CatalogRelation *input_relation =\n       optimizer_context_->catalog_database()->getRelationByIdMutable(\n             input_relation_info->relation->getID());\n+\n+  // check if any index with the specified name already exists\n   if (input_relation->hasIndexWithName(physical_plan->index_name())) {\n     THROW_SQL_ERROR() << \"The relation \" << input_relation->getName()\n-            << \" already has an index named \"<< physical_plan->index_name();\n-  } else {\n-    execution_plan_->addRelationalOperator(\n-       new CreateIndexOperator(input_relation, physical_plan->index_name()));\n+    << \" already has an index named \"<< physical_plan->index_name();\n+  }\n+\n+  // assertion: must have at least one attribute specified to build index upon\n+  DEBUG_ASSERT(physical_plan->index_attributes().size() > 0);\n+\n+  // convert attribute references to a vector of pointers to catalog attributes\n+  std::vector<const CatalogAttribute*> index_attributes;\n+  for (const E::AttributeReferencePtr &attribute : physical_plan->index_attributes()) {\n+    const CatalogAttribute *catalog_attribute\n+      = input_relation->getAttributeByName(attribute->attribute_name());\n+    DEBUG_ASSERT(catalog_attribute != nullptr);","path":"query_optimizer/ExecutionGenerator.cpp","position":null,"original_position":27,"commit_id":"b5020fb1a4196837e534843e280fc48980367031","original_commit_id":"a3800a97818b3cb277f13537b6fc235a1c9caa54","user":{"login":"saketj","id":3624476,"avatar_url":"https://avatars.githubusercontent.com/u/3624476?v=3","gravatar_id":"","url":"https://api.github.com/users/saketj","html_url":"https://github.com/saketj","followers_url":"https://api.github.com/users/saketj/followers","following_url":"https://api.github.com/users/saketj/following{/other_user}","gists_url":"https://api.github.com/users/saketj/gists{/gist_id}","starred_url":"https://api.github.com/users/saketj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saketj/subscriptions","organizations_url":"https://api.github.com/users/saketj/orgs","repos_url":"https://api.github.com/users/saketj/repos","events_url":"https://api.github.com/users/saketj/events{/privacy}","received_events_url":"https://api.github.com/users/saketj/received_events","type":"User","site_admin":false},"body":"Replaced DEBUG_ASSERT with DCHECK.","created_at":"2016-03-11T21:23:25Z","updated_at":"2016-03-11T21:23:25Z","html_url":"https://github.com/pivotalsoftware/quickstep/pull/69#discussion_r55890530","pull_request_url":"https://api.github.com/repos/pivotalsoftware/quickstep/pulls/69","_links":{"self":{"href":"https://api.github.com/repos/pivotalsoftware/quickstep/pulls/comments/55890530"},"html":{"href":"https://github.com/pivotalsoftware/quickstep/pull/69#discussion_r55890530"},"pull_request":{"href":"https://api.github.com/repos/pivotalsoftware/quickstep/pulls/69"}}},"pull_request":{"url":"https://api.github.com/repos/pivotalsoftware/quickstep/pulls/69","id":61910618,"html_url":"https://github.com/pivotalsoftware/quickstep/pull/69","diff_url":"https://github.com/pivotalsoftware/quickstep/pull/69.diff","patch_url":"https://github.com/pivotalsoftware/quickstep/pull/69.patch","issue_url":"https://api.github.com/repos/pivotalsoftware/quickstep/issues/69","number":69,"state":"open","locked":false,"title":"CREATE INDEX now saves a new index and its properties in the catalog","user":{"login":"saketj","id":3624476,"avatar_url":"https://avatars.githubusercontent.com/u/3624476?v=3","gravatar_id":"","url":"https://api.github.com/users/saketj","html_url":"https://github.com/saketj","followers_url":"https://api.github.com/users/saketj/followers","following_url":"https://api.github.com/users/saketj/following{/other_user}","gists_url":"https://api.github.com/users/saketj/gists{/gist_id}","starred_url":"https://api.github.com/users/saketj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saketj/subscriptions","organizations_url":"https://api.github.com/users/saketj/orgs","repos_url":"https://api.github.com/users/saketj/repos","events_url":"https://api.github.com/users/saketj/events{/privacy}","received_events_url":"https://api.github.com/users/saketj/received_events","type":"User","site_admin":false},"body":"This is the final PR towards CREATE INDEX implementation in Quickstep that saves newly created indices and their properties in the catalog. \r\nThe CatalogProto has been modified to define a new message type- 'IndexScheme', which contains the set of indices defined on the relation. Within the index scheme, each index is represented as an IndexEntry that contains a string index_name, and an associated protobuf IndexSubBlockDescription. \r\n\r\nAddition of an index creates an IndexEntry in the catalog and also adds a new index sub block to the StorageBlockLayout. Duplicate indices can be checked by going through a map of indices maintained by the catalog. The PR also adds support for flexible parsing and definition of any number of properties on a given index. \r\n\r\nOpen Issues (to be fixed in the next commit to this PR):\r\n- Add more tests for ExecutionGenerator and CreateIndexOperator\r\n- Cleanup and fix IWYU issues\r\n- Complete comments for the cpp files, as well","created_at":"2016-03-07T12:28:16Z","updated_at":"2016-03-11T21:23:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0ea54dd7fd9028c99ae26ac48d5738636ff4484e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/pivotalsoftware/quickstep/pulls/69/commits","review_comments_url":"https://api.github.com/repos/pivotalsoftware/quickstep/pulls/69/comments","review_comment_url":"https://api.github.com/repos/pivotalsoftware/quickstep/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pivotalsoftware/quickstep/issues/69/comments","statuses_url":"https://api.github.com/repos/pivotalsoftware/quickstep/statuses/b5020fb1a4196837e534843e280fc48980367031","head":{"label":"pivotalsoftware:index-properties-resolver","ref":"index-properties-resolver","sha":"b5020fb1a4196837e534843e280fc48980367031","user":{"login":"pivotalsoftware","id":4247270,"avatar_url":"https://avatars.githubusercontent.com/u/4247270?v=3","gravatar_id":"","url":"https://api.github.com/users/pivotalsoftware","html_url":"https://github.com/pivotalsoftware","followers_url":"https://api.github.com/users/pivotalsoftware/followers","following_url":"https://api.github.com/users/pivotalsoftware/following{/other_user}","gists_url":"https://api.github.com/users/pivotalsoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/pivotalsoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pivotalsoftware/subscriptions","organizations_url":"https://api.github.com/users/pivotalsoftware/orgs","repos_url":"https://api.github.com/users/pivotalsoftware/repos","events_url":"https://api.github.com/users/pivotalsoftware/events{/privacy}","received_events_url":"https://api.github.com/users/pivotalsoftware/received_events","type":"Organization","site_admin":false},"repo":{"id":45578105,"name":"quickstep","full_name":"pivotalsoftware/quickstep","owner":{"login":"pivotalsoftware","id":4247270,"avatar_url":"https://avatars.githubusercontent.com/u/4247270?v=3","gravatar_id":"","url":"https://api.github.com/users/pivotalsoftware","html_url":"https://github.com/pivotalsoftware","followers_url":"https://api.github.com/users/pivotalsoftware/followers","following_url":"https://api.github.com/users/pivotalsoftware/following{/other_user}","gists_url":"https://api.github.com/users/pivotalsoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/pivotalsoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pivotalsoftware/subscriptions","organizations_url":"https://api.github.com/users/pivotalsoftware/orgs","repos_url":"https://api.github.com/users/pivotalsoftware/repos","events_url":"https://api.github.com/users/pivotalsoftware/events{/privacy}","received_events_url":"https://api.github.com/users/pivotalsoftware/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pivotalsoftware/quickstep","description":"Quickstep Project","fork":false,"url":"https://api.github.com/repos/pivotalsoftware/quickstep","forks_url":"https://api.github.com/repos/pivotalsoftware/quickstep/forks","keys_url":"https://api.github.com/repos/pivotalsoftware/quickstep/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pivotalsoftware/quickstep/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pivotalsoftware/quickstep/teams","hooks_url":"https://api.github.com/repos/pivotalsoftware/quickstep/hooks","issue_events_url":"https://api.github.com/repos/pivotalsoftware/quickstep/issues/events{/number}","events_url":"https://api.github.com/repos/pivotalsoftware/quickstep/events","assignees_url":"https://api.github.com/repos/pivotalsoftware/quickstep/assignees{/user}","branches_url":"https://api.github.com/repos/pivotalsoftware/quickstep/branches{/branch}","tags_url":"https://api.github.com/repos/pivotalsoftware/quickstep/tags","blobs_url":"https://api.github.com/repos/pivotalsoftware/quickstep/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pivotalsoftware/quickstep/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pivotalsoftware/quickstep/git/refs{/sha}","trees_url":"https://api.github.com/repos/pivotalsoftware/quickstep/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pivotalsoftware/quickstep/statuses/{sha}","languages_url":"https://api.github.com/repos/pivotalsoftware/quickstep/languages","stargazers_url":"https://api.github.com/repos/pivotalsoftware/quickstep/stargazers","contributors_url":"https://api.github.com/repos/pivotalsoftware/quickstep/contributors","subscribers_url":"https://api.github.com/repos/pivotalsoftware/quickstep/subscribers","subscription_url":"https://api.github.com/repos/pivotalsoftware/quickstep/subscription","commits_url":"https://api.github.com/repos/pivotalsoftware/quickstep/commits{/sha}","git_commits_url":"https://api.github.com/repos/pivotalsoftware/quickstep/git/commits{/sha}","comments_url":"https://api.github.com/repos/pivotalsoftware/quickstep/comments{/number}","issue_comment_url":"https://api.github.com/repos/pivotalsoftware/quickstep/issues/comments{/number}","contents_url":"https://api.github.com/repos/pivotalsoftware/quickstep/contents/{+path}","compare_url":"https://api.github.com/repos/pivotalsoftware/quickstep/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pivotalsoftware/quickstep/merges","archive_url":"https://api.github.com/repos/pivotalsoftware/quickstep/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pivotalsoftware/quickstep/downloads","issues_url":"https://api.github.com/repos/pivotalsoftware/quickstep/issues{/number}","pulls_url":"https://api.github.com/repos/pivotalsoftware/quickstep/pulls{/number}","milestones_url":"https://api.github.com/repos/pivotalsoftware/quickstep/milestones{/number}","notifications_url":"https://api.github.com/repos/pivotalsoftware/quickstep/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pivotalsoftware/quickstep/labels{/name}","releases_url":"https://api.github.com/repos/pivotalsoftware/quickstep/releases{/id}","deployments_url":"https://api.github.com/repos/pivotalsoftware/quickstep/deployments","created_at":"2015-11-05T01:06:50Z","updated_at":"2016-03-09T18:55:47Z","pushed_at":"2016-03-11T21:19:58Z","git_url":"git://github.com/pivotalsoftware/quickstep.git","ssh_url":"git@github.com:pivotalsoftware/quickstep.git","clone_url":"https://github.com/pivotalsoftware/quickstep.git","svn_url":"https://github.com/pivotalsoftware/quickstep","homepage":null,"size":6861,"stargazers_count":7,"watchers_count":7,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":12,"forks":7,"open_issues":12,"watchers":7,"default_branch":"master"}},"base":{"label":"pivotalsoftware:master","ref":"master","sha":"c058b40d45c852170b5da7d9466981df6fb1bf25","user":{"login":"pivotalsoftware","id":4247270,"avatar_url":"https://avatars.githubusercontent.com/u/4247270?v=3","gravatar_id":"","url":"https://api.github.com/users/pivotalsoftware","html_url":"https://github.com/pivotalsoftware","followers_url":"https://api.github.com/users/pivotalsoftware/followers","following_url":"https://api.github.com/users/pivotalsoftware/following{/other_user}","gists_url":"https://api.github.com/users/pivotalsoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/pivotalsoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pivotalsoftware/subscriptions","organizations_url":"https://api.github.com/users/pivotalsoftware/orgs","repos_url":"https://api.github.com/users/pivotalsoftware/repos","events_url":"https://api.github.com/users/pivotalsoftware/events{/privacy}","received_events_url":"https://api.github.com/users/pivotalsoftware/received_events","type":"Organization","site_admin":false},"repo":{"id":45578105,"name":"quickstep","full_name":"pivotalsoftware/quickstep","owner":{"login":"pivotalsoftware","id":4247270,"avatar_url":"https://avatars.githubusercontent.com/u/4247270?v=3","gravatar_id":"","url":"https://api.github.com/users/pivotalsoftware","html_url":"https://github.com/pivotalsoftware","followers_url":"https://api.github.com/users/pivotalsoftware/followers","following_url":"https://api.github.com/users/pivotalsoftware/following{/other_user}","gists_url":"https://api.github.com/users/pivotalsoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/pivotalsoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pivotalsoftware/subscriptions","organizations_url":"https://api.github.com/users/pivotalsoftware/orgs","repos_url":"https://api.github.com/users/pivotalsoftware/repos","events_url":"https://api.github.com/users/pivotalsoftware/events{/privacy}","received_events_url":"https://api.github.com/users/pivotalsoftware/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pivotalsoftware/quickstep","description":"Quickstep Project","fork":false,"url":"https://api.github.com/repos/pivotalsoftware/quickstep","forks_url":"https://api.github.com/repos/pivotalsoftware/quickstep/forks","keys_url":"https://api.github.com/repos/pivotalsoftware/quickstep/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pivotalsoftware/quickstep/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pivotalsoftware/quickstep/teams","hooks_url":"https://api.github.com/repos/pivotalsoftware/quickstep/hooks","issue_events_url":"https://api.github.com/repos/pivotalsoftware/quickstep/issues/events{/number}","events_url":"https://api.github.com/repos/pivotalsoftware/quickstep/events","assignees_url":"https://api.github.com/repos/pivotalsoftware/quickstep/assignees{/user}","branches_url":"https://api.github.com/repos/pivotalsoftware/quickstep/branches{/branch}","tags_url":"https://api.github.com/repos/pivotalsoftware/quickstep/tags","blobs_url":"https://api.github.com/repos/pivotalsoftware/quickstep/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pivotalsoftware/quickstep/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pivotalsoftware/quickstep/git/refs{/sha}","trees_url":"https://api.github.com/repos/pivotalsoftware/quickstep/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pivotalsoftware/quickstep/statuses/{sha}","languages_url":"https://api.github.com/repos/pivotalsoftware/quickstep/languages","stargazers_url":"https://api.github.com/repos/pivotalsoftware/quickstep/stargazers","contributors_url":"https://api.github.com/repos/pivotalsoftware/quickstep/contributors","subscribers_url":"https://api.github.com/repos/pivotalsoftware/quickstep/subscribers","subscription_url":"https://api.github.com/repos/pivotalsoftware/quickstep/subscription","commits_url":"https://api.github.com/repos/pivotalsoftware/quickstep/commits{/sha}","git_commits_url":"https://api.github.com/repos/pivotalsoftware/quickstep/git/commits{/sha}","comments_url":"https://api.github.com/repos/pivotalsoftware/quickstep/comments{/number}","issue_comment_url":"https://api.github.com/repos/pivotalsoftware/quickstep/issues/comments{/number}","contents_url":"https://api.github.com/repos/pivotalsoftware/quickstep/contents/{+path}","compare_url":"https://api.github.com/repos/pivotalsoftware/quickstep/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pivotalsoftware/quickstep/merges","archive_url":"https://api.github.com/repos/pivotalsoftware/quickstep/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pivotalsoftware/quickstep/downloads","issues_url":"https://api.github.com/repos/pivotalsoftware/quickstep/issues{/number}","pulls_url":"https://api.github.com/repos/pivotalsoftware/quickstep/pulls{/number}","milestones_url":"https://api.github.com/repos/pivotalsoftware/quickstep/milestones{/number}","notifications_url":"https://api.github.com/repos/pivotalsoftware/quickstep/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pivotalsoftware/quickstep/labels{/name}","releases_url":"https://api.github.com/repos/pivotalsoftware/quickstep/releases{/id}","deployments_url":"https://api.github.com/repos/pivotalsoftware/quickstep/deployments","created_at":"2015-11-05T01:06:50Z","updated_at":"2016-03-09T18:55:47Z","pushed_at":"2016-03-11T21:19:58Z","git_url":"git://github.com/pivotalsoftware/quickstep.git","ssh_url":"git@github.com:pivotalsoftware/quickstep.git","clone_url":"https://github.com/pivotalsoftware/quickstep.git","svn_url":"https://github.com/pivotalsoftware/quickstep","homepage":null,"size":6861,"stargazers_count":7,"watchers_count":7,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":12,"forks":7,"open_issues":12,"watchers":7,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pivotalsoftware/quickstep/pulls/69"},"html":{"href":"https://github.com/pivotalsoftware/quickstep/pull/69"},"issue":{"href":"https://api.github.com/repos/pivotalsoftware/quickstep/issues/69"},"comments":{"href":"https://api.github.com/repos/pivotalsoftware/quickstep/issues/69/comments"},"review_comments":{"href":"https://api.github.com/repos/pivotalsoftware/quickstep/pulls/69/comments"},"review_comment":{"href":"https://api.github.com/repos/pivotalsoftware/quickstep/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pivotalsoftware/quickstep/pulls/69/commits"},"statuses":{"href":"https://api.github.com/repos/pivotalsoftware/quickstep/statuses/b5020fb1a4196837e534843e280fc48980367031"}}}}