gokceni commented on a change in pull request #640: PHOENIX-5578 - CREATE TABLE 
IF NOT EXISTS loads IndexRegionObserver o…
URL: https://github.com/apache/phoenix/pull/640#discussion_r349394369
 
 

 ##########
 File path: 
phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
 ##########
 @@ -999,6 +1007,23 @@ private void addCoprocessors(byte[] tableName, 
HTableDescriptor descriptor, PTab
         }
     }
 
+    private boolean doesPhoenixTableAlreadyExist(HTableDescriptor 
existingDesc) {
+        //if the table descriptor already has Phoenix coprocs, we assume it's
+        //already gone through a Phoenix create statement once
+        if (existingDesc == null){
+            return false;
+        }
+        boolean hasScanObserver = 
existingDesc.hasCoprocessor(ScanRegionObserver.class.getName());
+        boolean hasUnAggObserver = existingDesc.hasCoprocessor(
+            UngroupedAggregateRegionObserver.class.getName());
+        boolean hasGroupedObserver = existingDesc.hasCoprocessor(
+            GroupedAggregateRegionObserver.class.getName());
+        boolean hasIndexObserver = 
existingDesc.hasCoprocessor(Indexer.class.getName())
+            || existingDesc.hasCoprocessor(IndexRegionObserver.class.getName())
+            || existingDesc.hasCoprocessor(GlobalIndexChecker.class.getName());
+        return hasScanObserver && hasUnAggObserver && hasGroupedObserver && 
hasIndexObserver;
 
 Review comment:
   Rather than checking coprocessors one by one, why don't we check that the 
coprocessors on the table length is greater than 0? 

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to