kasakrisz commented on code in PR #6203:
URL: https://github.com/apache/hive/pull/6203#discussion_r2542001693


##########
ql/src/test/org/apache/hadoop/hive/ql/io/orc/TestFixAcidKeyIndex.java:
##########
@@ -72,12 +72,22 @@ static abstract class TestKeyIndexBuilder
   }
 
   void createTestAcidFile(Path path, int numRows, TestKeyIndexBuilder 
indexBuilder) throws Exception {
+    createTestAcidFile(path, numRows, indexBuilder, false);
+  }
+
+  void createTestAcidFile(Path path,
+                          int numRows,
+                          TestKeyIndexBuilder indexBuilder,
+                          boolean acidMetadataLowerCase) throws Exception {
     FileSystem fs = path.getFileSystem(conf);
     fs.delete(path, true);
     String typeStr = "struct<operation:int," +
         "originalTransaction:bigint,bucket:int,rowId:bigint," +
         "currentTransaction:bigint," +
         "row:struct<a:int,b:struct<c:int>,d:string>>";
+    if (acidMetadataLowerCase) {
+      typeStr = typeStr.toLowerCase();
+    }

Review Comment:
   How about extracting `typeStr` to a constant and pass it as a parameter to 
`createTestAcidFile`. It would give more control to the caller.



##########
ql/src/test/org/apache/hadoop/hive/ql/io/orc/TestFixAcidKeyIndex.java:
##########
@@ -219,6 +229,27 @@ public void testValidKeyIndex() throws Exception {
     fixValidIndex(testFilePath);
   }
 
+  @Test
+  public void testValidKeyIndexWithAcidMetadataLowerCase() throws Exception {
+    // Try with 0 row file.
+    createTestAcidFile(testFilePath, 0, new GoodKeyIndexBuilder(), true);
+    checkValidKeyIndex(testFilePath);
+    // Attempting to fix a valid - should not result in a new file.
+    fixValidIndex(testFilePath);
+
+    // Try single stripe
+    createTestAcidFile(testFilePath, 100, new GoodKeyIndexBuilder(), true);
+    checkValidKeyIndex(testFilePath);
+    // Attempting to fix a valid - should not result in a new file.
+    fixValidIndex(testFilePath);
+
+    // Multiple stripes
+    createTestAcidFile(testFilePath, 12000, new GoodKeyIndexBuilder(), true);
+    checkValidKeyIndex(testFilePath);
+    // Attempting to fix a valid - should not result in a new file.
+    fixValidIndex(testFilePath);

Review Comment:
   Could you please move these to new test methods.



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