deniskuzZ commented on code in PR #5246:
URL: https://github.com/apache/hive/pull/5246#discussion_r1600412336


##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HMSHandler.java:
##########
@@ -5563,26 +5563,21 @@ public List<Partition> get_partitions_with_auth(final 
String dbName,
   private void checkLimitNumberOfPartitionsByFilter(String catName, String 
dbName,
                                                     String tblName, String 
filterString,
                                                     int maxParts) throws 
TException {
-    if (isPartitionLimitEnabled()) {
+    if (needCheckPartitionLimit(maxParts)) {

Review Comment:
   ````
     private void checkLimitNumberOfPartitionsByPs(String catName, String 
dbName, String tblName,
                                                   List<String> partVals, int 
maxParts)
             throws TException {
       if (needCheckPartitionLimit(maxParts)) {
         checkLimitNumberOfPartitions(tblName, getNumPartitionsByPs(catName, 
dbName, tblName,
                 partVals));
       }
     }
   
     private boolean needCheckPartitionLimit(int requestSize) {
       int partitionLimit = MetastoreConf.getIntVar(conf, 
ConfVars.LIMIT_PARTITION_REQUEST);
       return partitionLimit > -1 && (requestSize < 0 || requestSize > 
partitionLimit);
     }
   
     private void checkLimitNumberOfPartitions(String tblName, int 
numPartitions) throws MetaException {
       int partitionLimit = MetastoreConf.getIntVar(conf, 
ConfVars.LIMIT_PARTITION_REQUEST);
       if (partitionLimit > -1 && numPartitions > partitionLimit) {
         String configName = ConfVars.LIMIT_PARTITION_REQUEST.toString();
         throw new 
MetaException(String.format(PARTITION_NUMBER_EXCEED_LIMIT_MSG, numPartitions,
             tblName, partitionLimit, configName));
       }
     }
   ````
   1. can we reuse `if (needCheckPartitionLimit(partitionLimit) {...}` 
   to be honest I don't really get what is the purpose of that check
   2. where do we limit the fetch size? we throw ab exception if returned 
`numPartitions` > `partitionLimit`?
   say request size is 100, LIMIT = 50 and in db we have 1000, we'll return 
PARTITION_NUMBER_EXCEED_LIMIT_MSG exception to the end user? 
   wouldn't it be better if we return first 50



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to