stevenzwu commented on code in PR #13941:
URL: https://github.com/apache/iceberg/pull/13941#discussion_r2316805506


##########
spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/data/ParquetWithSparkSchemaVisitor.java:
##########
@@ -154,11 +155,10 @@ public static <T> T visit(DataType sType, Type type, 
ParquetWithSparkSchemaVisit
         } finally {
           visitor.fieldNames.pop();
         }
-      } else if (sType instanceof VariantType) {
-        // TODO: Use LogicalTypeAnnotation.variantType().equals(annotation) 
when VARIANT type is
-        // added to Parquet
-        // Preconditions.checkArgument(
-        //  sType instanceof VariantType, "Invalid variant: %s is not a 
VariantType", sType);
+      } else if 
(LogicalTypeAnnotation.variantType(Variant.VARIANT_SPEC_VERSION)
+          .equals(annotation)) {
+        Preconditions.checkArgument(
+            sType instanceof VariantType, "Invalid variant: %s is not a 
VariantType", sType);

Review Comment:
   nit: we typically don't use the class name directly in the error msg. maybe 
sth like this?
   
   ```
   Invalid variant: Spark type %s is not a variant type
   ```



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to