Skip to content

Commit ff48144

Browse files
committed
Cache table permission check
1 parent 2010a0b commit ff48144

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
@@ -264,11 +264,12 @@ class TableUtils(@transient val sparkSession: SparkSession) extends Serializable
264264
try {
265265
// retrieve one row from the table
266266
val partitionFilter = lastAvailablePartition(tableName).getOrElse(fallbackPartition)
267-
sparkSession.read
267+
val df = sparkSession.read
268268
.load(DataPointer.from(tableName, sparkSession))
269269
.where(s"$partitionColumn='$partitionFilter'")
270270
.limit(1)
271-
.collect()
271+
df.cache
272+
df.collect()
272273
true
273274
} catch {
274275
case e: SparkException =>

0 commit comments

Comments
 (0)