amrishlal commented on code in PR #8879:
URL: https://github.com/apache/hudi/pull/8879#discussion_r1224737333
##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/HoodieSparkSqlWriter.scala:
##########
@@ -1160,21 +1171,29 @@ object HoodieSparkSqlWriter {
// handle dropping partition columns
it.map { avroRec =>
- val processedRecord = if (shouldDropPartitionColumns) {
- HoodieAvroUtils.rewriteRecord(avroRec, dataFileSchema)
+ val (hoodieKey: HoodieKey, recordLocation:
Option[HoodieRecordLocation]) = getKeyAndLocatorFromAvroRecord(keyGenerator,
avroRec,
+ isPrepped)
+
+ val avroRecWithoutMeta: GenericRecord = if (isPrepped) {
+ HoodieAvroUtils.rewriteRecord(avroRec,
HoodieAvroUtils.removeMetadataFields(dataFileSchema))
} else {
avroRec
}
- val hoodieKey = new HoodieKey(keyGenerator.getRecordKey(avroRec),
keyGenerator.getPartitionPath(avroRec))
+ val processedRecord = if (shouldDropPartitionColumns) {
+ HoodieAvroUtils.rewriteRecord(avroRecWithoutMeta, dataFileSchema)
+ } else {
+ avroRecWithoutMeta
+ }
+
val hoodieRecord = if (shouldCombine) {
val orderingVal = HoodieAvroUtils.getNestedFieldVal(avroRec,
config.getString(PRECOMBINE_FIELD),
false,
consistentLogicalTimestampEnabled).asInstanceOf[Comparable[_]]
DataSourceUtils.createHoodieRecord(processedRecord, orderingVal,
hoodieKey,
- config.getString(PAYLOAD_CLASS_NAME))
+ config.getString(PAYLOAD_CLASS_NAME),
recordLocation.getOrElse(null))
} else {
- DataSourceUtils.createHoodieRecord(processedRecord, hoodieKey,
- config.getString(PAYLOAD_CLASS_NAME))
+ // AKL_TODO: check if this change is needed.
Review Comment:
Fixed.
--
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]