jpisaac commented on code in PR #1844:
URL: https://github.com/apache/phoenix/pull/1844#discussion_r1679734459


##########
phoenix-core-client/src/main/java/org/apache/phoenix/compile/CreateTableCompiler.java:
##########
@@ -164,9 +185,29 @@ 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;
+                    boolean updatableViewRestrictionEnabled = 
connection.getQueryServices()
+                            
.getProps().getBoolean(PHOENIX_UPDATABLE_VIEW_RESTRICTION_ENABLED,
+                                    
DEFAULT_PHOENIX_UPDATABLE_VIEW_RESTRICTION_ENABLED);
+                    if (viewTypeToBe == ViewType.UPDATABLE && 
updatableViewRestrictionEnabled) {
+                        ViewWhereExpressionValidatorVisitor validatorVisitor =
+                                new 
ViewWhereExpressionValidatorVisitor(parentToBe,
+                                        pkColumnsInWhere, nonPkColumnsInWhere);
+                        where.accept(validatorVisitor);
+                        if (!(connection.getQueryServices()
+                                instanceof ConnectionlessQueryServicesImpl)) {
+                            try {
+                                viewTypeToBe = setViewTypeToBe(connection, 
parentToBe,
+                                        pkColumnsInWhere, nonPkColumnsInWhere);
+                            } catch (IOException e) {
+                                throw new RuntimeException(e);

Review Comment:
   Do we want to throw a RuntimeException? OR build a SQLException and throw 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to