akashrn5 commented on code in PR #18387:
URL: https://github.com/apache/iceberg/pull/18387#discussion_r4312844216


##########
spark/v4.0/spark/src/test/java/org/apache/iceberg/spark/data/TestSparkOrcReader.java:
##########
@@ -124,4 +131,51 @@ public void testUnknownMapType() {
         .isInstanceOf(IllegalArgumentException.class)
         .hasMessageStartingWith("Cannot create MapType with unknown value 
type");
   }
+
+  @Test
+  public void variantIsNotSupported() throws IOException {
+    File testFile = writeVariantOrcFile();
+
+    try (CloseableIterable<InternalRow> reader =
+        ORC.read(Files.localInput(testFile))
+            .project(VARIANT_SCHEMA)
+            .createReaderFunc(readOrcSchema -> new 
SparkOrcReader(VARIANT_SCHEMA, readOrcSchema))
+            .build()) {
+      assertThatThrownBy(reader::iterator)
+          .isInstanceOf(UnsupportedOperationException.class)
+          .hasMessage("Variant is not supported");
+    }
+  }
+
+  @Test
+  public void variantIsNotSupportedWhenVectorized() throws IOException {
+    File testFile = writeVariantOrcFile();
+
+    try (CloseableIterable<ColumnarBatch> reader =
+        ORC.read(Files.localInput(testFile))
+            .project(VARIANT_SCHEMA)
+            .createBatchedReaderFunc(
+                readOrcSchema ->
+                    VectorizedSparkOrcReaders.buildReader(
+                        VARIANT_SCHEMA, readOrcSchema, ImmutableMap.of()))
+            .build()) {
+      assertThatThrownBy(reader::iterator)
+          .isInstanceOf(UnsupportedOperationException.class)
+          .hasMessage("Variant is not supported");
+    }
+  }
+
+  private File writeVariantOrcFile() throws IOException {
+    File testFile = File.createTempFile("junit", null, temp.toFile());
+    assertThat(testFile.delete()).as("Delete should succeed").isTrue();
+
+    FileAppender<Record> writer =

Review Comment:
   i used try with resource and created an actual record for the test, please 
review



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