hudi-agent commented on code in PR #19687:
URL: https://github.com/apache/hudi/pull/19687#discussion_r3820425047
##########
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:
🤖 nit: `AtTheTableSchema` reads a bit awkwardly — could you rename this to
`bootstrapReaderReconstructsShreddedDataFileUsingTableSchema` (or
`...WithTableSchema`) to match the more natural English phrasing?
<sub><i>⚠️ AI-generated; verify before applying. React 👍/👎 to flag
quality.</i></sub>
##########
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:
🤖 nit: the Java twin in
`MultipleSparkJobExecutionStrategy.validateSortColumns` ends with "Remove it
from the clustering sort columns." — worth adding the same actionable hint here
so both error paths give the user the same guidance.
<sub><i>⚠️ AI-generated; verify before applying. React 👍/👎 to flag
quality.</i></sub>
--
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]