zstan commented on code in PR #912:
URL: https://github.com/apache/ignite-3/pull/912#discussion_r915563665


##########
modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/jdbc/ItJdbcMetadataSelfTest.java:
##########
@@ -87,41 +132,79 @@ public static void createTables() {
                         .changePartitions(10)
         );
 
+        clusterNodes.get(0).tables().createTable(allTypesTbl.canonicalName(), 
tblCh ->
+                SchemaConfigurationConverter.convert(allTypesTbl, tblCh)
+        );
+
         Table tbl1 = 
clusterNodes.get(0).tables().table(perTbl.canonicalName());
         Table tbl2 = 
clusterNodes.get(0).tables().table(orgTbl.canonicalName());
 
         tbl1.recordView().insert(null, Tuple.create().set("ORGID", 
1).set("NAME", "111").set("AGE", 111));
         tbl2.recordView().insert(null, Tuple.create().set("ID", 1).set("NAME", 
"AAA").set("BIGDATA", BigDecimal.valueOf(10)));
     }
 
+    @Test
+    public void testColumnTypesDescribed() throws Exception {
+        Statement stmt = DriverManager.getConnection(URL).createStatement();
+
+        ResultSet rs = stmt.executeQuery("select * from ALLTYPES");
+
+        assertNotNull(rs);
+
+        ResultSetMetaData meta = rs.getMetaData();
+
+        assertNotNull(meta);
+
+        assertEquals(allColumns.size(), meta.getColumnCount());
+
+        int pos = 0;
+
+        for (Pair<ColumnDefinition, Integer> colDef : allColumns) {
+            assertNotEquals("OTHER", meta.getColumnTypeName(++pos), "Column 
type not described: " + meta.getColumnName(pos));
+            assertEquals(colDef.getSecond(), meta.getColumnType(pos), 
"Unexpected column type: " + meta.getColumnType(pos));
+        }
+    }
+
     @Test
     public void testResultSetMetaData() throws Exception {
         Statement stmt = DriverManager.getConnection(URL).createStatement();
 
         ResultSet rs = stmt.executeQuery(
-                "select p.name, o.id as orgId, p.age from PERSON p, 
ORGANIZATION o where p.orgId = o.id");
+                "select p.name, o.id as orgId, p.age, o.dur, o.per from PERSON 
p, ORGANIZATION o where p.orgId = o.id");
 
         assertNotNull(rs);
 
         ResultSetMetaData meta = rs.getMetaData();
 
         assertNotNull(meta);
 
-        assertEquals(3, meta.getColumnCount());
+        assertEquals(5, meta.getColumnCount());
 
         assertEquals("Person".toUpperCase(), 
meta.getTableName(1).toUpperCase());
         assertEquals("name".toUpperCase(), 
meta.getColumnName(1).toUpperCase());
         assertEquals("name".toUpperCase(), 
meta.getColumnLabel(1).toUpperCase());
         assertEquals(VARCHAR, meta.getColumnType(1));
-        assertEquals(meta.getColumnTypeName(1), "VARCHAR");
-        assertEquals(meta.getColumnClassName(1), "java.lang.String");
+        assertEquals("VARCHAR", meta.getColumnTypeName(1));
+        assertEquals("java.lang.String", meta.getColumnClassName(1));
 
         assertEquals("Organization".toUpperCase(), 
meta.getTableName(2).toUpperCase());
         assertEquals("id".toUpperCase(), meta.getColumnName(2).toUpperCase());
         assertEquals("orgId".toUpperCase(), 
meta.getColumnLabel(2).toUpperCase());
         assertEquals(INTEGER, meta.getColumnType(2));
-        assertEquals(meta.getColumnTypeName(2), "INTEGER");
-        assertEquals(meta.getColumnClassName(2), "java.lang.Integer");
+        assertEquals("INTEGER", meta.getColumnTypeName(2));
+        assertEquals("java.lang.Integer", meta.getColumnClassName(2));
+
+        assertEquals("dur".toUpperCase(), meta.getColumnName(4).toUpperCase());
+        assertEquals("dur".toUpperCase(), 
meta.getColumnLabel(4).toUpperCase());
+        assertEquals(OTHER, meta.getColumnType(4));
+        assertEquals("OTHER", meta.getColumnTypeName(4));
+        assertEquals("java.time.Duration", meta.getColumnClassName(4));
+
+        assertEquals("per".toUpperCase(), meta.getColumnName(5).toUpperCase());
+        assertEquals("per".toUpperCase(), 
meta.getColumnLabel(5).toUpperCase());
+        assertEquals(OTHER, meta.getColumnType(5));
+        assertEquals("OTHER", meta.getColumnTypeName(5));

Review Comment:
   seems INTERVAL more correct here



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to