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/06/16 21:58:34 UTC

[GitHub] [phoenix] yanxinyi opened a new pull request #802: PHOENIX-5960 Creating a view on a non-existent table throws the wrong…

yanxinyi opened a new pull request #802:
URL: https://github.com/apache/phoenix/pull/802


   … exception


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



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

Posted by GitBox <gi...@apache.org>.
yanxinyi commented on pull request #802:
URL: https://github.com/apache/phoenix/pull/802#issuecomment-645033207


   @ChinmaySKulkarni please review this short changes.


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



[GitHub] [phoenix] yanxinyi closed pull request #802: PHOENIX-5960 Creating a view on a non-existent table throws the wrong…

Posted by GitBox <gi...@apache.org>.
yanxinyi closed pull request #802:
URL: https://github.com/apache/phoenix/pull/802


   


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



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

Posted by GitBox <gi...@apache.org>.
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



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

Posted by GitBox <gi...@apache.org>.
gjacoby126 commented on a change in pull request #802:
URL: https://github.com/apache/phoenix/pull/802#discussion_r441189418



##########
File path: phoenix-core/src/main/java/org/apache/phoenix/compile/CreateTableCompiler.java
##########
@@ -178,8 +179,8 @@ public MutationPlan compile(CreateTableStatement create) throws SQLException {
                     }
                 }
                 if (isPKMissed) {
-                    throw new SQLExceptionInfo.Builder(SQLExceptionCode.PRIMARY_KEY_MISSING)
-                            .build().buildException();
+                    throw new TableNotFoundException(tableRef.getTable().getSchemaName().toString(),

Review comment:
       Are there cases where the original exception would be the correct one that we need to distinguish? 




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



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

Posted by GitBox <gi...@apache.org>.
yanxinyi commented on pull request #802:
URL: https://github.com/apache/phoenix/pull/802#issuecomment-645105290


   @gjacoby126 yes, we do need handle table is not available v.s pk is missing.


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