wombatu-kun commented on code in PR #16345:
URL: https://github.com/apache/iceberg/pull/16345#discussion_r3463686354


##########
orc/src/test/java/org/apache/iceberg/orc/TestTableProperties.java:
##########
@@ -54,23 +54,15 @@ public class TestTableProperties {
   @TempDir private File testFile;
 
   @Test
-  public void testOrcTableProperties() throws Exception {
-    Random random = new Random();
-    int numOfCodecs = CompressionKind.values().length;
-    int numOfStrategies = CompressionStrategy.values().length;
-
-    long stripeSizeBytes = 32L * 1024 * 1024;
-    long blockSizeBytes = 128L * 1024 * 1024;
-    String codecAsString = 
CompressionKind.values()[random.nextInt(numOfCodecs)].name();
-    String strategyAsString = 
CompressionStrategy.values()[random.nextInt(numOfStrategies)].name();
+  public void testOrcTablePropertiesForDataFile() throws Exception {
+    String codecAsString = CompressionKind.SNAPPY.name();
 
     ImmutableMap<String, String> properties =
         ImmutableMap.of(
-            TableProperties.ORC_STRIPE_SIZE_BYTES, 
String.valueOf(stripeSizeBytes),
-            TableProperties.ORC_BLOCK_SIZE_BYTES, 
String.valueOf(blockSizeBytes),

Review Comment:
   They flow through `ORC.WriteBuilder.build()`: `Context.dataContext(config)` 
derives stripe size, block size, codec and strategy from the table properties, 
then four adjacent `OrcConf.*.set(conf, ...)` calls put them on the 
`Configuration` handed to `OrcFileAppender` and on to the ORC writer.
   
   That path is exactly what the reworked tests now exercise end-to-end: 
`ORC.write().forTable(table).build()` writes a real file through it and 
`getCompressionKind()` reads the codec back off the file, instead of reflecting 
into the private `conf` field.
   
   I asserted only on compression because it is the one of the four observable 
from the output: stripe size depends on data volume, and block size and 
compression strategy are not recorded in the ORC footer. All four are set by 
the same straight-line block, so the codec read-back is a representative 
end-to-end check. I can add a direct `Context.dataContext()`/`deleteContext()` 
assertion over all four values if you would rather pin the mapping explicitly.



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