voonhous commented on code in PR #19687:
URL: https://github.com/apache/hudi/pull/19687#discussion_r3820522958
##########
hudi-spark-datasource/hudi-spark4-common/src/test/java/org/apache/hudi/io/storage/hadoop/TestHoodieVariantReconstructionRoundTrip.java:
##########
@@ -175,4 +185,85 @@ private static byte[] toBytes(Object byteBuffer) {
buf.get(out);
return out;
}
+
+ @Test
+ void bootstrapReaderReconstructsShreddedDataFileAtTheTableSchema(@TempDir
java.nio.file.Path tmp) throws Exception {
+ // HoodieMergeHelper's bootstrap branch uses the one-argument
getRecordIterator overload,
Review Comment:
Done -- renamed to
`bootstrapReaderReconstructsShreddedDataFileUsingTableSchema`.
##########
hudi-spark-datasource/hudi-spark/src/main/scala/org/apache/spark/sql/hudi/command/procedures/RunClusteringProcedure.scala:
##########
@@ -233,11 +234,22 @@ class RunClusteringProcedure extends BaseProcedure
}
val tableSchemaResolver = new TableSchemaResolver(metaClient)
- val fields = tableSchemaResolver.getTableSchema(false)
- .getFields.asScala.map(_.name().toLowerCase)
+ val fieldsByName = tableSchemaResolver.getTableSchema(false)
+ .getFields.asScala.map(field => field.name().toLowerCase -> field).toMap
orderColumns.split(",").foreach(col => {
- if (!fields.contains(col.toLowerCase)) {
- throw new HoodieClusteringException("Order column not exist:" + col)
+ fieldsByName.get(col.toLowerCase) match {
+ case None =>
+ throw new HoodieClusteringException("Order column not exist:" + col)
+ case Some(field) =>
+ // Types without an ordering used to fail deep in the clustering job
(an
+ // AnalysisException from the row partitioner, a ClassCastException
from the RDD one);
+ // reject them here and name the column instead.
+ val fieldType = field.schema().getNonNullType.getType
+ if (fieldType == HoodieSchemaType.VARIANT || fieldType ==
HoodieSchemaType.BLOB
+ || fieldType == HoodieSchemaType.VECTOR) {
Review Comment:
Done.
--
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]