ignite-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [ignite] alex-plekhanov commented on a change in pull request #6916: IGNITE-12213: Sql objects system views.
Date Thu, 03 Oct 2019 12:26:03 GMT
alex-plekhanov commented on a change in pull request #6916: IGNITE-12213: Sql objects system
views.
URL: https://github.com/apache/ignite/pull/6916#discussion_r331010217
 
 

 ##########
 File path: modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/metric/SqlViewExporterSpiTest.java
 ##########
 @@ -332,6 +339,162 @@ public void testTransactions() throws Exception {
         assertTrue(res);
     }
 
+    /** */
+    @Test
+    public void testSchemas() throws Exception {
+        try (IgniteEx g = startGrid(new IgniteConfiguration().setSqlSchemas("MY_SCHEMA",
"ANOTHER_SCHEMA"))) {
+            SystemView<SqlSchemaView> schemasSysView = g.context().systemView().view(SQL_SCHEMA_VIEW);
+
+            Set<String> schemaFromSysView = new HashSet<>();
+
+            schemasSysView.forEach(v -> schemaFromSysView.add(v.name()));
+
+            HashSet<String> expSchemas = new HashSet<>(asList("MY_SCHEMA", "ANOTHER_SCHEMA",
"SYS", "PUBLIC"));
+
+            assertEquals(schemaFromSysView, expSchemas);
+
+            List<List<?>> schemas = execute(g, "SELECT * FROM SYS.SCHEMAS");
+
+            schemaFromSysView.clear();
+            schemas.forEach(s -> schemaFromSysView.add(s.get(0).toString()));
+
+            assertEquals(schemaFromSysView, expSchemas);
+        }
+    }
+
+    /** */
+    @Test
+    public void testViews() throws Exception {
+        Set<String> expViews = new HashSet<>(asList(
+            "METRICS",
+            "SERVICES",
+            "CACHE_GROUPS",
+            "CACHES",
+            "TASKS",
+            "LOCAL_SQL_QUERY_HISTORY",
+            "NODES",
+            "SCHEMAS",
+            "NODE_METRICS",
+            "BASELINE_NODES",
+            "INDEXES",
+            "LOCAL_CACHE_GROUPS_IO",
+            "LOCAL_SQL_RUNNING_QUERIES",
+            "NODE_ATTRIBUTES",
+            "TABLES",
+            "CLIENT_CONNECTIONS",
+            "VIEWS",
+            "TABLE_COLUMNS",
+            "VIEW_COLUMNS",
+            "TRANSACTIONS"
+        ));
+
+        Set<String> actViews = new HashSet<>();
+
+        List<List<?>> res = execute(ignite, "SELECT * FROM SYS.VIEWS");
+
+        for (List<?> row : res)
+            actViews.add(row.get(0).toString());
+
+        assertEquals(expViews, actViews);
+    }
+
+    /** */
+    @Test
+    public void testTable() throws Exception {
+        assertTrue(execute(ignite, "SELECT * FROM SYS.TABLES").isEmpty());
+
+        execute(ignite, "CREATE TABLE T1(ID LONG PRIMARY KEY, NAME VARCHAR)");
+
+        List<List<?>> res = execute(ignite, "SELECT * FROM SYS.TABLES");
+
+        assertEquals(1, res.size());
+
+        List tbl = res.get(0);
+
+        int cacheId = cacheId("SQL_PUBLIC_T1");
+        String cacheName = "SQL_PUBLIC_T1";
+
+        assertEquals("T1", tbl.get(0)); //TABLE_NAME
 
 Review comment:
   Space after `//`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message