[ 
https://issues.apache.org/jira/browse/PHOENIX-6457?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17338558#comment-17338558
 ] 

ASF GitHub Bot commented on PHOENIX-6457:
-----------------------------------------

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



##########
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:
       There's not meant to be any cascade behavior here...what changes should 
I assert on? Just that that the base table didn't change? I could do that. 




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


> Optionally store schema version string in SYSTEM.CATALOG
> --------------------------------------------------------
>
>                 Key: PHOENIX-6457
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-6457
>             Project: Phoenix
>          Issue Type: New Feature
>            Reporter: Geoffrey Jacoby
>            Assignee: Geoffrey Jacoby
>            Priority: Major
>             Fix For: 4.17.0, 5.2.0
>
>
> In many environments, schema changes to Phoenix tables are applied in batches 
> associated with a version of an application. (For example, v1.0 of an app may 
> start with one set of CREATE statements, v1.1 then adds some ALTER 
> statements, etc.) 
> It can be useful to be able to look up the latest app version in which a 
> table or view was changed; this could potentially be added as a feature of 
> the Schema Tool. 
> This change would add an optional property to CREATE and ALTER statements, 
> SCHEMA_VERSION, which would take a user-supplied string. 
> This is also a pre-req for PHOENIX-6227, because we would want to pass the 
> schema version string, if any, to an external schema repository in 
> environments where we're integrating with one. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to