You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2021/12/28 12:14:42 UTC
[GitHub] [hudi] codope commented on a change in pull request #4404: [HUDI-2558] Fixing Clustering w/ sort columns with null values fails
codope commented on a change in pull request #4404:
URL: https://github.com/apache/hudi/pull/4404#discussion_r775876469
##########
File path: hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/execution/bulkinsert/RDDCustomColumnsSortPartitioner.java
##########
@@ -55,8 +55,17 @@ public RDDCustomColumnsSortPartitioner(String[] columnNames, Schema schema) {
final String[] sortColumns = this.sortColumnNames;
final SerializableSchema schema = this.serializableSchema;
return records.sortBy(
- record -> HoodieAvroUtils.getRecordColumnValues(record, sortColumns, schema),
+ record -> {
+ Object recordValue = HoodieAvroUtils.getRecordColumnValues(record, sortColumns, schema);
+ // null values are replaced with empty string for null_first order
+ if (recordValue == null) {
+ return "";
Review comment:
Consider using `StringUtils.EMPTY_STRING`.
##########
File path: hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/execution/bulkinsert/RDDCustomColumnsSortPartitioner.java
##########
@@ -55,8 +55,17 @@ public RDDCustomColumnsSortPartitioner(String[] columnNames, Schema schema) {
final String[] sortColumns = this.sortColumnNames;
final SerializableSchema schema = this.serializableSchema;
return records.sortBy(
- record -> HoodieAvroUtils.getRecordColumnValues(record, sortColumns, schema),
+ record -> {
+ Object recordValue = HoodieAvroUtils.getRecordColumnValues(record, sortColumns, schema);
+ // null values are replaced with empty string for null_first order
+ if (recordValue == null) {
+ return "";
+ } else {
+ return recordValue.toString();
Review comment:
Consider using `StringUtils#objToString`
--
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: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org