AngersZhuuuu commented on a change in pull request #31179:
URL: https://github.com/apache/spark/pull/31179#discussion_r604554605
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/FileFormatDataWriter.scala
##########
@@ -251,7 +252,18 @@ class DynamicPartitionDataWriter(
// See a new partition or bucket - write to a new partition dir (or a
new bucket file).
if (isPartitioned && currentPartitionValues != nextPartitionValues) {
currentPartitionValues = Some(nextPartitionValues.get.copy())
- statsTrackers.foreach(_.newPartition(currentPartitionValues.get))
+ val partitionSpec: Map[String, String] =
description.partitionColumns.map(attr => {
+ val proj = UnsafeProjection.create(Seq(attr),
description.partitionColumns)
+ val attrRow = proj(currentPartitionValues.get)
+ val value = if (attrRow.isNullAt(0)) {
+ null
+ } else {
+ Cast(Literal(attrRow.get(0, attr.dataType), attr.dataType),
+ StringType,
Some(SQLConf.get.sessionLocalTimeZone)).eval().toString
+ }
+ attr.name -> value
Review comment:
> this additional projection looks not good for performance.
So should we not do projection here and do this in driver side when update
metrics?
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]