Skip to content

Commit

Permalink
Spark: Cached ClickHouse table is not used by SQL (#274) (#275)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouyifan279 authored Oct 27, 2023
1 parent fed4cd2 commit 5e83d0c
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -436,4 +436,19 @@ class ClickHouseSingleSuite extends SparkClickHouseSingleTest {
createOrReplaceTable()
}
}

test("cache table") {
val db = "cache_db"
val tbl = "cache_tbl"

withSimpleTable(db, tbl, true) {
try {
spark.sql(s"CACHE TABLE $db.$tbl")
val cachedPlan = spark.sql(s"SELECT * FROM $db.$tbl").queryExecution.commandExecuted
.find(node => spark.sharedState.cacheManager.lookupCachedData(node).isDefined)
assert(cachedPlan.isDefined)
} finally
spark.sql(s"UNCACHE TABLE $db.$tbl")
}
}
}

0 comments on commit 5e83d0c

Please sign in to comment.