tkhurana commented on code in PR #2041:
URL: https://github.com/apache/phoenix/pull/2041#discussion_r1886859680


##########
phoenix-core-client/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java:
##########
@@ -761,13 +761,22 @@ public PTable getTable(String name) throws SQLException {
     }
 
     public PTable getTable(PTableKey key) throws SQLException {
-        PTable table;
-        try {
-            table = getTableRef(key).getTable();
-        } catch (TableNotFoundException e) {
-            table =  getTableNoCache(key.getName());
+        PTableRef tableRef = getTableRefNoTNFE(key);
+        if (tableRef == null && key.getTenantId() != null) {
+            tableRef = getTableRefNoTNFE(new PTableKey(null, key.getName()));

Review Comment:
   Consider the case when there is a tenant view on the table and the tenant 
has the same name as the underlying table. I think Phoenix allows that. Then if 
the base table is in the cache but the tenant view is not in the cache you will 
return the base table object.



##########
phoenix-core-client/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java:
##########
@@ -761,13 +761,22 @@ public PTable getTable(String name) throws SQLException {
     }
 
     public PTable getTable(PTableKey key) throws SQLException {
-        PTable table;
-        try {
-            table = getTableRef(key).getTable();
-        } catch (TableNotFoundException e) {
-            table =  getTableNoCache(key.getName());
+        PTableRef tableRef = getTableRefNoTNFE(key);
+        if (tableRef == null && key.getTenantId() != null) {
+            tableRef = getTableRefNoTNFE(new PTableKey(null, key.getName()));

Review Comment:
   @sanjeet006py  Consider the case when there is a tenant view on the table 
and the tenant has the same name as the underlying table. I think Phoenix 
allows that. Then if the base table is in the cache but the tenant view is not 
in the cache you will return the base table object.



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