{"action":"created","comment":{"url":"https://api.github.com/repos/crate/crate/pulls/comments/36647376","id":36647376,"diff_hunk":"@@ -0,0 +1,124 @@\n+/*\n+ * Licensed to Crate.IO GmbH (\"Crate\") under one or more contributor\n+ * license agreements.  See the NOTICE file distributed with this work for\n+ * additional information regarding copyright ownership.  Crate licenses\n+ * this file to you under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.  You may\n+ * obtain a copy of the License at\n+ *\n+ *     http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the\n+ * License for the specific language governing permissions and limitations\n+ * under the License.\n+ *\n+ * However, if you have executed another commercial license agreement\n+ * with Crate these terms will supersede the license and you may use the\n+ * software solely pursuant to the terms of the relevant commercial agreement.\n+ */\n+\n+package io.crate.metadata.sys;\n+\n+import com.google.common.collect.ImmutableList;\n+import io.crate.analyze.WhereClause;\n+import io.crate.core.collections.TreeMapBuilder;\n+import io.crate.metadata.*;\n+import io.crate.planner.RowGranularity;\n+import io.crate.types.DataType;\n+import io.crate.types.DataTypes;\n+import org.elasticsearch.cluster.ClusterService;\n+import org.elasticsearch.common.inject.Inject;\n+import org.elasticsearch.common.inject.Singleton;\n+\n+import javax.annotation.Nullable;\n+import java.util.LinkedHashMap;\n+import java.util.LinkedHashSet;\n+import java.util.Map;\n+import java.util.List;\n+import java.util.Collection;\n+import java.util.Iterator;\n+\n+\n+@Singleton\n+public class SysChecksTableInfo extends SysTableInfo {\n+\n+    public static final TableIdent IDENT = new TableIdent(SCHEMA, \"checks\");\n+\n+    private static final ImmutableList<ColumnIdent> primaryKey = ImmutableList.of(new ColumnIdent(\"id\"));\n+\n+    private static final Map<ColumnIdent, ReferenceInfo> INFOS = new LinkedHashMap<>();\n+    private static final LinkedHashSet<ReferenceInfo> columns = new LinkedHashSet<>();\n+\n+    public static class Columns {\n+        private static final ColumnIdent ID = new ColumnIdent(\"id\");\n+        public static final ColumnIdent SEVERITY = new ColumnIdent(\"severity\");\n+        public static final ColumnIdent DESCRIPTION = new ColumnIdent(\"description\");\n+        public static final ColumnIdent PASSED = new ColumnIdent(\"passed\");\n+\n+    }\n+\n+    static {\n+        register(Columns.ID, DataTypes.STRING);\n+        register(Columns.SEVERITY, DataTypes.INTEGER);\n+        register(Columns.DESCRIPTION, DataTypes.STRING);\n+        register(Columns.PASSED, DataTypes.BOOLEAN);\n+    }\n+\n+    private static ReferenceInfo register(ColumnIdent columnIdent, DataType type) {\n+        ReferenceInfo info = new ReferenceInfo(new ReferenceIdent(IDENT, columnIdent), RowGranularity.CLUSTER, type);\n+        if (info.ident().isColumn()) {\n+            columns.add(info);\n+        }\n+        INFOS.put(info.ident().columnIdent(), info);\n+        return info;\n+    }\n+\n+\n+    @Inject\n+    protected SysChecksTableInfo(ClusterService clusterService, SysSchemaInfo sysSchemaInfo) {\n+        super(clusterService, sysSchemaInfo);\n+    }\n+\n+    @Nullable\n+    @Override\n+    public ReferenceInfo getReferenceInfo(ColumnIdent columnIdent) {\n+        return INFOS.get(columnIdent);\n+    }\n+\n+    @Override\n+    public Collection<ReferenceInfo> columns() {\n+        return columns;\n+    }\n+\n+    @Override\n+    public RowGranularity rowGranularity() {\n+        return RowGranularity.CLUSTER;\n+    }\n+\n+    @Override\n+    public TableIdent ident() {\n+        return IDENT;\n+    }\n+\n+    @Override\n+    public Routing getRouting(WhereClause whereClause, @Nullable String preference) {","path":"sql/src/main/java/io/crate/metadata/sys/SysChecksTableInfo.java","position":106,"original_position":106,"commit_id":"1d9741fc4a3d07086fe399a521475b9357612263","original_commit_id":"1d9741fc4a3d07086fe399a521475b9357612263","user":{"login":"chaudum","id":281260,"avatar_url":"https://avatars.githubusercontent.com/u/281260?v=3","gravatar_id":"","url":"https://api.github.com/users/chaudum","html_url":"https://github.com/chaudum","followers_url":"https://api.github.com/users/chaudum/followers","following_url":"https://api.github.com/users/chaudum/following{/other_user}","gists_url":"https://api.github.com/users/chaudum/gists{/gist_id}","starred_url":"https://api.github.com/users/chaudum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chaudum/subscriptions","organizations_url":"https://api.github.com/users/chaudum/orgs","repos_url":"https://api.github.com/users/chaudum/repos","events_url":"https://api.github.com/users/chaudum/events{/privacy}","received_events_url":"https://api.github.com/users/chaudum/received_events","type":"User","site_admin":false},"body":"check if required to override\r\ntry re-using it","created_at":"2015-08-10T15:52:42Z","updated_at":"2015-08-10T15:52:42Z","html_url":"https://github.com/crate/crate/pull/2415#discussion_r36647376","pull_request_url":"https://api.github.com/repos/crate/crate/pulls/2415","_links":{"self":{"href":"https://api.github.com/repos/crate/crate/pulls/comments/36647376"},"html":{"href":"https://github.com/crate/crate/pull/2415#discussion_r36647376"},"pull_request":{"href":"https://api.github.com/repos/crate/crate/pulls/2415"}}},"pull_request":{"url":"https://api.github.com/repos/crate/crate/pulls/2415","id":42028258,"html_url":"https://github.com/crate/crate/pull/2415","diff_url":"https://github.com/crate/crate/pull/2415.diff","patch_url":"https://github.com/crate/crate/pull/2415.patch","issue_url":"https://api.github.com/repos/crate/crate/issues/2415","number":2415,"state":"open","locked":false,"title":"Add sys.checks table","user":{"login":"kovrus","id":7442373,"avatar_url":"https://avatars.githubusercontent.com/u/7442373?v=3","gravatar_id":"","url":"https://api.github.com/users/kovrus","html_url":"https://github.com/kovrus","followers_url":"https://api.github.com/users/kovrus/followers","following_url":"https://api.github.com/users/kovrus/following{/other_user}","gists_url":"https://api.github.com/users/kovrus/gists{/gist_id}","starred_url":"https://api.github.com/users/kovrus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kovrus/subscriptions","organizations_url":"https://api.github.com/users/kovrus/orgs","repos_url":"https://api.github.com/users/kovrus/repos","events_url":"https://api.github.com/users/kovrus/events{/privacy}","received_events_url":"https://api.github.com/users/kovrus/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-08-10T14:50:50Z","updated_at":"2015-08-10T15:52:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4f298965490a98e9616d81913bf8c52a6e0a3fd0","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/crate/crate/pulls/2415/commits","review_comments_url":"https://api.github.com/repos/crate/crate/pulls/2415/comments","review_comment_url":"https://api.github.com/repos/crate/crate/pulls/comments{/number}","comments_url":"https://api.github.com/repos/crate/crate/issues/2415/comments","statuses_url":"https://api.github.com/repos/crate/crate/statuses/1d9741fc4a3d07086fe399a521475b9357612263","head":{"label":"crate:r/sys.table","ref":"r/sys.table","sha":"1d9741fc4a3d07086fe399a521475b9357612263","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: Your Elastic Data Store","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}","created_at":"2013-04-10T09:17:16Z","updated_at":"2015-08-10T05:14:12Z","pushed_at":"2015-08-10T15:28:21Z","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":104728,"stargazers_count":968,"watchers_count":968,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":99,"mirror_url":null,"open_issues_count":38,"forks":99,"open_issues":38,"watchers":968,"default_branch":"master"}},"base":{"label":"crate:r/sys.checks","ref":"r/sys.checks","sha":"7eb9bb0942682c7b51eb938e1b5fb5917dd115d7","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: Your Elastic Data Store","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}","created_at":"2013-04-10T09:17:16Z","updated_at":"2015-08-10T05:14:12Z","pushed_at":"2015-08-10T15:28:21Z","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":104728,"stargazers_count":968,"watchers_count":968,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":99,"mirror_url":null,"open_issues_count":38,"forks":99,"open_issues":38,"watchers":968,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/crate/crate/pulls/2415"},"html":{"href":"https://github.com/crate/crate/pull/2415"},"issue":{"href":"https://api.github.com/repos/crate/crate/issues/2415"},"comments":{"href":"https://api.github.com/repos/crate/crate/issues/2415/comments"},"review_comments":{"href":"https://api.github.com/repos/crate/crate/pulls/2415/comments"},"review_comment":{"href":"https://api.github.com/repos/crate/crate/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/crate/crate/pulls/2415/commits"},"statuses":{"href":"https://api.github.com/repos/crate/crate/statuses/1d9741fc4a3d07086fe399a521475b9357612263"}}}}