[
https://issues.apache.org/jira/browse/PHOENIX-4555?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17774203#comment-17774203
]
ASF GitHub Bot commented on PHOENIX-4555:
-----------------------------------------
jinggou commented on code in PR #1704:
URL: https://github.com/apache/phoenix/pull/1704#discussion_r1355629441
##########
phoenix-core/src/main/java/org/apache/phoenix/compile/CreateTableCompiler.java:
##########
@@ -160,9 +170,23 @@ public MutationPlan compile(CreateTableStatement create)
throws SQLException {
viewColumnConstantsToBe = new byte[nColumns][];
ViewWhereExpressionVisitor visitor = new
ViewWhereExpressionVisitor(parentToBe, viewColumnConstantsToBe);
where.accept(visitor);
+
+ viewTypeToBe = visitor.isUpdatable() ? ViewType.UPDATABLE
: ViewType.READ_ONLY;
+ if (viewTypeToBe == ViewType.UPDATABLE) {
+ ViewWhereExpressionValidatorVisitor validatorVisitor =
+ new
ViewWhereExpressionValidatorVisitor(parentToBe,
+ pkColumnsInWhere, nonPkColumnsInWhere);
+ where.accept(validatorVisitor);
+ try {
+ viewTypeToBe = setViewTypeToBe(connection,
parentToBe, pkColumnsInWhere,
+ nonPkColumnsInWhere);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
Review Comment:
not sure if try-catch here is a good practice
> Only mark view as updatable if rows cannot overlap with other updatable views
> -----------------------------------------------------------------------------
>
> Key: PHOENIX-4555
> URL: https://issues.apache.org/jira/browse/PHOENIX-4555
> Project: Phoenix
> Issue Type: Sub-task
> Reporter: James R. Taylor
> Assignee: Jing Yu
> Priority: Major
>
> We'll run into issues if updatable sibling views overlap with each other. For
> example, say you have the following hierarchy:
> T (A, B, C)
> V1 (D, E) FROM T WHERE A = 1
> V2 (F, G) FROM T WHERE A = 1 and B = 2
> In this case, there's no way to update both V1 and v2 columns. Secondary
> indexes wouldn't work either, if you had one on each V1 & V2.
> We should restrict updatable views to
> - views that filter on PK column(s)
> - sibling views filter on same set of PK column(s)
--
This message was sent by Atlassian Jira
(v8.20.10#820010)