swaroopak commented on a change in pull request #1216:
URL: https://github.com/apache/phoenix/pull/1216#discussion_r625229666



##########
File path: 
phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableWithViewsIT.java
##########
@@ -1465,6 +1465,28 @@ public void testLastDDLTimestampWithChildViews() throws 
Exception {
 
     }
 
-
+    @Test
+    public void testCreateViewSchemaVersion() throws Exception {
+        Properties props = new Properties();
+        final String schemaName = generateUniqueName();
+        final String tableName = generateUniqueName();
+        final String viewName = generateUniqueName();
+        final String dataTableFullName = SchemaUtil.getTableName(schemaName, 
tableName);
+        final String viewFullName = SchemaUtil.getTableName(schemaName, 
viewName);
+        try (Connection conn = DriverManager.getConnection(getUrl(), props)) {
+            String oldVersion = "V1.0";
+            CreateTableIT.testCreateTableSchemaVersionHelper(conn, schemaName, 
tableName, oldVersion);
+            String createViewSql = "CREATE VIEW " + viewFullName + " AS SELECT 
* FROM " + dataTableFullName +
+                    " SCHEMA_VERSION='" + oldVersion + "'";
+            conn.createStatement().execute(createViewSql);
+            PTable view = PhoenixRuntime.getTableNoCache(conn, viewFullName);
+            assertEquals(oldVersion, view.getSchemaVersion());
+            String newVersion = "V1.1";
+            String alterViewSql = "ALTER VIEW " + viewFullName + " SET 
SCHEMA_VERSION='" + newVersion + "'";
+            conn.createStatement().execute(alterViewSql);
+            PTable view2 = PhoenixRuntime.getTableNoCache(conn, viewFullName);
+            assertEquals(newVersion, view2.getSchemaVersion());

Review comment:
       should we assert on changes on datatable schema version as well?




-- 
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:
[email protected]


Reply via email to