You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by ur...@apache.org on 2026/08/13 15:31:17 UTC
(spark) branch branch-4.x updated: [SPARK-58760][SQL] Use consistent colName interpolation in CatalogColumnStat
This is an automated email from the ASF dual-hosted git repository.
uros-b pushed a commit to branch branch-4.x
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/branch-4.x by this push:
new 010a9d465d0a [SPARK-58760][SQL] Use consistent colName interpolation in CatalogColumnStat
010a9d465d0a is described below
commit 010a9d465d0a0a9b3357514d8399e5a35528abf1
Author: Uros Bojanic <22...@users.noreply.github.com>
AuthorDate: Thu Aug 13 15:30:55 2026 +0000
[SPARK-58760][SQL] Use consistent colName interpolation in CatalogColumnStat
### What changes were proposed in this pull request?
Unbraces 14 `${colName}` interpolations to `$colName` in `CatalogColumnStat.toMap`/`fromMap`, leaving the qualified `${CatalogColumnStat.KEY_...}` / `${KEY_...}` selects braced.
### Why are the changes needed?
The two methods mix `${colName}` and the bare `$colName` for the same value, including on adjacent lines: the histogram key already reads `s"$colName.${CatalogColumnStat.KEY_HISTOGRAM}"`. This makes all 14 remaining sites consistent with that style. The qualified selects keep their braces on purpose, because unbracing `${CatalogColumnStat.KEY_VERSION}` would interpolate the object and append `.KEY_VERSION` as literal text.
### Does this PR introduce _any_ user-facing change?
No. These strings are the on-disk table-property keys for column statistics. In every case `colName` is a simple parameter immediately followed by `.`, so `$colName.` parses identically to `${colName}.` and the generated keys are byte-for-byte unchanged, preserving metadata compatibility.
### How was this patch tested?
Existing catalog statistics tests cover `toMap`/`fromMap`. The change is a lexical simplification with identical output.
### Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Opus 4.8)
Closes #57989 from uros-b/consistency-catalog-colstat-interp.
Authored-by: Uros Bojanic <22...@users.noreply.github.com>
Signed-off-by: Uros Bojanic <22...@users.noreply.github.com>
(cherry picked from commit c828ea1ef9e11faa5eeafabed693021389836c6e)
Signed-off-by: Uros Bojanic <22...@users.noreply.github.com>
---
.../spark/sql/catalyst/catalog/interface.scala | 28 +++++++++++-----------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/interface.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/interface.scala
index 247d4124dae4..377b649aaca0 100644
--- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/interface.scala
+++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/interface.scala
@@ -972,17 +972,17 @@ case class CatalogColumnStat(
*/
def toMap(colName: String): Map[String, String] = {
val map = new scala.collection.mutable.HashMap[String, String]
- map.put(s"${colName}.${CatalogColumnStat.KEY_VERSION}", CatalogColumnStat.VERSION.toString)
+ map.put(s"$colName.${CatalogColumnStat.KEY_VERSION}", CatalogColumnStat.VERSION.toString)
distinctCount.foreach { v =>
- map.put(s"${colName}.${CatalogColumnStat.KEY_DISTINCT_COUNT}", v.toString)
+ map.put(s"$colName.${CatalogColumnStat.KEY_DISTINCT_COUNT}", v.toString)
}
nullCount.foreach { v =>
- map.put(s"${colName}.${CatalogColumnStat.KEY_NULL_COUNT}", v.toString)
+ map.put(s"$colName.${CatalogColumnStat.KEY_NULL_COUNT}", v.toString)
}
- avgLen.foreach { v => map.put(s"${colName}.${CatalogColumnStat.KEY_AVG_LEN}", v.toString) }
- maxLen.foreach { v => map.put(s"${colName}.${CatalogColumnStat.KEY_MAX_LEN}", v.toString) }
- min.foreach { v => map.put(s"${colName}.${CatalogColumnStat.KEY_MIN_VALUE}", v) }
- max.foreach { v => map.put(s"${colName}.${CatalogColumnStat.KEY_MAX_VALUE}", v) }
+ avgLen.foreach { v => map.put(s"$colName.${CatalogColumnStat.KEY_AVG_LEN}", v.toString) }
+ maxLen.foreach { v => map.put(s"$colName.${CatalogColumnStat.KEY_MAX_LEN}", v.toString) }
+ min.foreach { v => map.put(s"$colName.${CatalogColumnStat.KEY_MIN_VALUE}", v) }
+ max.foreach { v => map.put(s"$colName.${CatalogColumnStat.KEY_MAX_VALUE}", v) }
histogram.foreach { h =>
CatalogTable.splitLargeTableProp(
s"$colName.${CatalogColumnStat.KEY_HISTOGRAM}",
@@ -1096,15 +1096,15 @@ object CatalogColumnStat extends Logging {
try {
Some(CatalogColumnStat(
- distinctCount = map.get(s"${colName}.${KEY_DISTINCT_COUNT}").map(v => BigInt(v.toLong)),
- min = map.get(s"${colName}.${KEY_MIN_VALUE}"),
- max = map.get(s"${colName}.${KEY_MAX_VALUE}"),
- nullCount = map.get(s"${colName}.${KEY_NULL_COUNT}").map(v => BigInt(v.toLong)),
- avgLen = map.get(s"${colName}.${KEY_AVG_LEN}").map(_.toLong),
- maxLen = map.get(s"${colName}.${KEY_MAX_LEN}").map(_.toLong),
+ distinctCount = map.get(s"$colName.${KEY_DISTINCT_COUNT}").map(v => BigInt(v.toLong)),
+ min = map.get(s"$colName.${KEY_MIN_VALUE}"),
+ max = map.get(s"$colName.${KEY_MAX_VALUE}"),
+ nullCount = map.get(s"$colName.${KEY_NULL_COUNT}").map(v => BigInt(v.toLong)),
+ avgLen = map.get(s"$colName.${KEY_AVG_LEN}").map(_.toLong),
+ maxLen = map.get(s"$colName.${KEY_MAX_LEN}").map(_.toLong),
histogram = CatalogTable.readLargeTableProp(map, s"$colName.$KEY_HISTOGRAM")
.map(HistogramSerializer.deserialize),
- version = map(s"${colName}.${KEY_VERSION}").toInt
+ version = map(s"$colName.${KEY_VERSION}").toInt
))
} catch {
case NonFatal(e) =>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org