hudi-agent commented on code in PR #19510:
URL: https://github.com/apache/hudi/pull/19510#discussion_r3791016872


##########
hudi-hadoop-mr/src/test/java/org/apache/hudi/hadoop/TestHoodieParquetInputFormat.java:
##########
@@ -837,4 +844,124 @@ public void testHoodieParquetInputFormatReadTimeType() 
throws IOException {
       jobConf.set(HoodieReaderConfig.FILE_GROUP_READER_ENABLED.key(), "true");
     }
   }
+
+  /**
+   * A bootstrap split carries two files: the split's own path is the 
skeleton, inside the table root, and
+   * {@code getBootstrapFileSplit()} is the external source file, which is 
not. A query projecting no columns
+   * at all - {@code SELECT COUNT(*)} - satisfies both "only one file is 
needed" conditions at once, so the
+   * order they are tested in decides which file Hive is handed.
+   *
+   * <p>Handing Hive a path outside the table root breaks its vectorized 
reader, which derives partition
+   * values by looking the split path up in {@code pathToPartitionInfo} 
(HUDI-5526, #15676). Hive 2.3 ships
+   * the same reader but defaults {@code hive.vectorized.execution.enabled} to 
false where Hive 3 defaults it
+   * to true, so this is gated by that config rather than by the Hive version.
+   *
+   * <p>Only the no-projection case is new behaviour: TestBootstrap and 
TestOrcBootstrap drive the other
+   * three branches end to end, they have just been disabled (HUDI-7353) since 
#10551.
+   */
+  @Test
+  public void testCountStarReadsSkeletonSoSplitPathStaysInsideTable() throws 
IOException {
+    BootstrapBaseFileSplit split = bootstrapSplit();
+
+    Option<FileSplit> resolved = 
HoodieParquetInputFormat.resolveSingleFileSplit(split, false, false);
+
+    assertTrue(resolved.isPresent(), "a query projecting no columns must 
resolve to a single file");
+    assertSame(split, resolved.get(),
+        "it must be the skeleton, whose path is inside the table root");
+  }
+
+  /**
+   * The remaining three combinations, which behave the same before and after 
the reorder: only meta columns
+   * needs the skeleton, only data columns needs the external file, and both 
needs them stitched.
+   */
+  @ParameterizedTest
+  @MethodSource("singleFileSplitCases")
+  public void testSingleFileSplitSelection(boolean anyHoodieCol, boolean 
anyExternalCol,
+                                           String expected) throws IOException 
{
+    BootstrapBaseFileSplit split = bootstrapSplit();
+
+    Option<FileSplit> resolved =
+        HoodieParquetInputFormat.resolveSingleFileSplit(split, anyHoodieCol, 
anyExternalCol);
+
+    if ("stitch".equals(expected)) {

Review Comment:
   🤖 nit: could you use a small enum or at least named constants instead of the 
raw strings `"skeleton"`, `"external"`, and `"stitch"` for the `expected` 
discriminator? A typo in any one of them silently passes the wrong assertion 
without a compile-time catch.
   
   <sub><i>⚠️ AI-generated; verify before applying. React 👍/👎 to flag 
quality.</i></sub>



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

Reply via email to