You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by GitBox <gi...@apache.org> on 2020/09/30 05:50:51 UTC

[GitHub] [phoenix] gjacoby126 commented on a change in pull request #898: PHOENIX-6158 create table/view should not update VIEW_INDEX_ID_DATA_T…

gjacoby126 commented on a change in pull request #898:
URL: https://github.com/apache/phoenix/pull/898#discussion_r497257076



##########
File path: phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ViewIndexIT.java
##########
@@ -626,4 +632,42 @@ private int getRowCountOfView(Connection conn, String schemaName, String viewNam
       }
       return size;
     }
+
+    @Test
+    public void testIndexIdDataTypeDefaultValue() throws Exception {
+        String tableName = "T_" + generateUniqueName();
+        String globalViewName = "V_" + generateUniqueName();
+        String globalViewIndexName = "GV_" + generateUniqueName();
+        try (Connection globalConn = getConnection()) {
+            createBaseTable(SCHEMA1, tableName, true, 0, null, true);
+            createView(globalConn, SCHEMA1, globalViewName, tableName);
+            createViewIndex(globalConn, SCHEMA1, globalViewIndexName, globalViewName, "v1");
+
+            String sql = "SELECT " + VIEW_INDEX_ID_DATA_TYPE + " FROM " + SYSTEM_CATALOG_NAME + " WHERE " +
+                    TABLE_SCHEM + " = '%s' AND " +
+                    TABLE_NAME + " = '%s' AND " +
+                    COLUMN_COUNT + " IS NOT NULL";
+            // should not have default value for table
+            ResultSet rs = globalConn.createStatement().executeQuery(String.format(sql, SCHEMA1, tableName));
+            if (rs.next()) {
+                assertEquals(null, rs.getObject(1));
+            } else {
+                fail();
+            }
+            // should not have default value for view
+            rs = globalConn.createStatement().executeQuery(String.format(sql, SCHEMA1, globalViewName));
+            if (rs.next()) {
+                assertEquals(null, rs.getObject(1));

Review comment:
       nit: also assertIsNull here

##########
File path: phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ViewIndexIT.java
##########
@@ -626,4 +632,42 @@ private int getRowCountOfView(Connection conn, String schemaName, String viewNam
       }
       return size;
     }
+
+    @Test
+    public void testIndexIdDataTypeDefaultValue() throws Exception {
+        String tableName = "T_" + generateUniqueName();
+        String globalViewName = "V_" + generateUniqueName();
+        String globalViewIndexName = "GV_" + generateUniqueName();
+        try (Connection globalConn = getConnection()) {
+            createBaseTable(SCHEMA1, tableName, true, 0, null, true);
+            createView(globalConn, SCHEMA1, globalViewName, tableName);
+            createViewIndex(globalConn, SCHEMA1, globalViewIndexName, globalViewName, "v1");
+
+            String sql = "SELECT " + VIEW_INDEX_ID_DATA_TYPE + " FROM " + SYSTEM_CATALOG_NAME + " WHERE " +
+                    TABLE_SCHEM + " = '%s' AND " +
+                    TABLE_NAME + " = '%s' AND " +
+                    COLUMN_COUNT + " IS NOT NULL";
+            // should not have default value for table
+            ResultSet rs = globalConn.createStatement().executeQuery(String.format(sql, SCHEMA1, tableName));
+            if (rs.next()) {
+                assertEquals(null, rs.getObject(1));

Review comment:
       nit: can do assertIsNull




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