openinx commented on a change in pull request #3248:
URL: https://github.com/apache/iceberg/pull/3248#discussion_r726904122



##########
File path: spark/src/main/java/org/apache/iceberg/spark/data/SparkOrcWriter.java
##########
@@ -42,75 +46,72 @@
  */
 public class SparkOrcWriter implements OrcRowWriter<InternalRow> {
 
-  private final SparkOrcValueWriter writer;
+  private final InternalRowWriter writer;
 
   public SparkOrcWriter(Schema iSchema, TypeDescription orcSchema) {
     Preconditions.checkArgument(orcSchema.getCategory() == 
TypeDescription.Category.STRUCT,
         "Top level must be a struct " + orcSchema);
 
-    writer = OrcSchemaWithTypeVisitor.visit(iSchema, orcSchema, new 
WriteBuilder());
+    writer = (InternalRowWriter) OrcSchemaWithTypeVisitor.visit(iSchema, 
orcSchema, new WriteBuilder());
   }
 
   @Override
   public void write(InternalRow value, VectorizedRowBatch output) {
-    Preconditions.checkArgument(writer instanceof StructWriter, "writer must 
be StructWriter");
+    Preconditions.checkArgument(value != null, "value must not be null");

Review comment:
       Okay, I just checked the flink/hive/spark write path, the `RowData`, 
`InternalRow` object cannot be allowed to set to be null, although all the 
field values from this row can set to be null. So this 
Preconditions#checkArgument looks good to me !  Thanks for you verification, 
@szlta !




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