[
https://issues.apache.org/jira/browse/PHOENIX-6158?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17204474#comment-17204474
]
ASF GitHub Bot commented on PHOENIX-6158:
-----------------------------------------
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:
[email protected]
> create table/view should not update VIEW_INDEX_ID_DATA_TYPE column
> ------------------------------------------------------------------
>
> Key: PHOENIX-6158
> URL: https://issues.apache.org/jira/browse/PHOENIX-6158
> Project: Phoenix
> Issue Type: Bug
> Affects Versions: 4.15.0
> Reporter: Xinyi Yan
> Priority: Major
> Fix For: 4.16.0
>
> Attachments: Screen Shot 2020-09-24 at 6.13.58 PM.png
>
>
> The VIEW_INDEX_ID_DATA_TYPE column should only give value when we create a
> view index, which is presenting data type(BIGINT VS SMALLINT) with the
> VIEW_INDEX_ID column.
> !Screen Shot 2020-09-24 at 6.13.58 PM.png!
--
This message was sent by Atlassian Jira
(v8.3.4#803005)