Skip to content

Commit 9159d3d

Browse files
Update spark/src/main/scala/ai/chronon/spark/TableUtils.scala
Co-authored-by: Nikhil Simha <[email protected]>
1 parent c9c3806 commit 9159d3d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

spark/src/main/scala/ai/chronon/spark/TableUtils.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -786,8 +786,9 @@ class TableUtils(@transient val sparkSession: SparkSession) extends Serializable
786786
val whereStr = allWheres.map(w => s"($w)").mkString(" AND ")
787787
df = df.where(whereStr)
788788
}
789-
val partitionCount = sparkSession.sparkContext.getConf.getInt("spark.default.parallelism", 1000)
790-
df.coalesce(partitionCount)
789+
val parallelism = sparkSession.sparkContext.getConf.getInt("spark.default.parallelism", 1000)
790+
val coalesceFactor = sparkSession.sparkContext.getConf.getInt("spark.chronon.coalesce.factor", 4)
791+
df.coalesce(coalesceFactor * parallelism)
791792
}
792793

793794
def whereClauses(partitionRange: PartitionRange, partitionColumn: String = partitionColumn): Seq[String] = {

0 commit comments

Comments
 (0)