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


##########
ql/src/java/org/apache/hadoop/hive/ql/metadata/PartitionIterable.java:
##########
@@ -173,6 +183,42 @@ public PartitionIterable(Hive db, Table table, Map<String, 
String> partialPartit
     this(db, table, partialPartitionSpec, batchSize, getColStats, false, null, 
null);
   }
 
+  public PartitionIterable(Hive db, Table table, int batchSize, 
GetPartitionsRequest getPartitionsRequest)
+      throws HiveException, TException {
+    if (batchSize < 1) {
+      throw new HiveException("Invalid batch size for partition iterable. 
Please use a batch size greater than 0");
+    }
+    this.currType = Type.LAZY_FETCH_PARTITIONS;
+    this.db = db;
+    this.table = table;
+    this.batchSize = batchSize;
+    this.getPartitionsRequest = getPartitionsRequest;
+    List<String> pVals = null;
+    if(getPartitionsRequest.isSetFilterSpec()){
+      pVals = this.getPartitionsRequest.getFilterSpec().getFilters();
+    }
+    if (pVals == null){
+      partitionNames = db.getPartitionNames(
+          table.getDbName(),table.getTableName(), (short) -1);
+    } else {
+      PartitionFilterMode filterMode = 
getPartitionsRequest.getFilterSpec().getFilterMode();

Review Comment:
   same code is used in 
`[PartitionTree.java](https://github.com/apache/hive/pull/5539/files#diff-f83827d7c6ec0a73bbc558101e64145afb555daff397c999c7491373253168c7)`
 try to reuse code and avoid code duplication



-- 
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: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to