Skip to content

Commit 48150b2

Browse files
wrap with config
Co-authored-by: Thomas Chow <[email protected]>
1 parent 7edd765 commit 48150b2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,10 @@ class TableUtils(@transient val sparkSession: SparkSession) extends Serializable
482482
wrapWithCache(s"repartition & write to $tableName", df) {
483483
logger.info("Repartitioning before writing...")
484484
val dataPointer = DataPointer.from(tableName, sparkSession)
485-
val repartitioned = repartitionInternal(df, tableName, stats, sortByCols)
485+
val repartitioned =
486+
if (sparkSession.conf.get("spark.chronon.write.repartition", "false").toBoolean)
487+
repartitionInternal(df, tableName, stats, sortByCols)
488+
else df
486489
repartitioned
487490
.select(repartitioned.columns.map {
488491
case c if c == partitionColumn && dataPointer.writeFormat.map(_.toUpperCase).exists("BIGQUERY".equals) =>

0 commit comments

Comments
 (0)