wombatu-kun commented on code in PR #20326:
URL: https://github.com/apache/hudi/pull/20326#discussion_r4278215790
##########
hudi-spark-datasource/hudi-spark4-common/src/main/java/org/apache/hudi/variant/Spark4VariantShreddingProvider.java:
##########
@@ -176,7 +176,16 @@ private VariantSchema buildVariantSchema(Schema
avroSchema, boolean isTopLevel,
break;
default:
- // Scalar shredding
+ // Scalar shredding. On write (non-null builder), reject leaf types
Spark 4 cannot shred,
+ // as SparkShreddingUtils.buildVariantSchema does with
invalidVariantShreddingSchema.
+ if (builder != null && !isSparkShreddableScalar(tvSchema)) {
+ LogicalType logicalType = tvSchema.getLogicalType();
+ String typeName = tvSchema.getType().getName()
+ + (logicalType == null ? "" : " (" + logicalType.getName() +
")");
+ throw new HoodieException("Variant shredding schema has a
typed_value of type " + typeName
Review Comment:
+1
--
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]