zratkai commented on code in PR #4912:
URL: https://github.com/apache/hive/pull/4912#discussion_r1415505514


##########
ql/src/test/org/apache/hadoop/hive/ql/exec/TestGetPartitionInBatches.java:
##########
@@ -256,4 +258,21 @@ public void testBatchingWhenException() throws Exception {
         // In case any duplicate/incomplete list is given by 
hive.getAllPartitionsInBatches, the below assertion will fail
         assert(partNames.size() == 0);
     }
+
+    @Test
+    public void testBatchingWhenBatchSizeIsZero() throws MetaException {
+        HiveMetaStoreClient spyMSC = spy(msc);
+        hive.setMSC(spyMSC);
+        int batchSize = 0;
+        try {
+            new PartitionIterable(hive, hive.getTable(dbName, tableName), 
null, batchSize);
+        } catch (HiveException e) {
+            Assert.assertTrue(e.getMessage().contains("Batch Size for 
Partition Iterable should be > 0"));

Review Comment:
   @aturoczy I agree with you. I think the easiest solution would be to create 
an enum for different type of exceptions, and make it as mandatory constructor 
value for HiveException. Something similar refactoring was done in Spark: 
https://issues.apache.org/jira/browse/SPARK-35958



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