You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by GitBox <gi...@apache.org> on 2020/07/09 23:20:32 UTC

[GitHub] [phoenix] ChinmaySKulkarni commented on a change in pull request #802: PHOENIX-5960 Creating a view on a non-existent table throws the wrong…

ChinmaySKulkarni commented on a change in pull request #802:
URL: https://github.com/apache/phoenix/pull/802#discussion_r452540866



##########
File path: phoenix-core/src/main/java/org/apache/phoenix/compile/CreateTableCompiler.java
##########
@@ -177,9 +179,22 @@ public MutationPlan compile(CreateTableStatement create) throws SQLException {
                         }
                     }
                 }
+
                 if (isPKMissed) {
-                    throw new SQLExceptionInfo.Builder(SQLExceptionCode.PRIMARY_KEY_MISSING)
-                            .build().buildException();
+                    boolean isTableAvailable = true;
+                    try (HBaseAdmin admin = connection.unwrap(PhoenixConnection.class).getQueryServices().getAdmin()) {

Review comment:
       Instead of an extra admin call to check the base table existence here, wouldn't we be checking this already somewhere in the create view path already? I'm wondering if we can avoid this extra check and just let the exception bubble out from that original place. Maybe we can pass the `isPKMissed` flag so that we know later on whether to throw TNFE or Primary-key-missing SQLException




----------------------------------------------------------------
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:
users@infra.apache.org