ajantha-bhat commented on code in PR #4902:
URL: https://github.com/apache/iceberg/pull/4902#discussion_r884769318
##########
spark/v3.2/spark/src/main/java/org/apache/iceberg/spark/actions/SparkZOrderStrategy.java:
##########
@@ -133,6 +133,14 @@ public SparkZOrderStrategy(Table table, SparkSession
spark, List<String> zOrderC
"Cannot perform ZOrdering, all columns provided were identity
partition columns and cannot be used.");
}
+ zOrderColNames.forEach(col -> {
+ NestedField nestedField = table.schema().caseInsensitiveFindField(col);
+ if (nestedField == null) {
+ throw new IllegalArgumentException(
+ String.format("Cannot find field '%s' in struct: %s", col,
table.schema().asStruct()));
+ }
+ });
Review Comment:
the above validation was implicitly handled from this
https://github.com/apache/iceberg/blob/master/spark/v3.2/spark/src/main/java/org/apache/iceberg/spark/actions/SparkZOrderStrategy.java#L185-L187
But it is too late and it doesn't enter here for an empty table. So, added
the above to catch the error early.
--
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]