You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Wenchen Fan (Jira)" <ji...@apache.org> on 2023/10/10 06:43:00 UTC
[jira] [Resolved] (SPARK-45449) Cache Invalidation Issue with JDBC Table
[ https://issues.apache.org/jira/browse/SPARK-45449?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Wenchen Fan resolved SPARK-45449.
---------------------------------
Fix Version/s: 3.5.1
4.0.0
Resolution: Fixed
Issue resolved by pull request 43258
[https://github.com/apache/spark/pull/43258]
> Cache Invalidation Issue with JDBC Table
> ----------------------------------------
>
> Key: SPARK-45449
> URL: https://issues.apache.org/jira/browse/SPARK-45449
> Project: Spark
> Issue Type: Bug
> Components: SQL
> Affects Versions: 3.5.0
> Reporter: liangyongyuan
> Priority: Major
> Labels: pull-request-available
> Fix For: 3.5.1, 4.0.0
>
>
> We have identified a cache invalidation issue when caching JDBC tables in Spark SQL. The cached table is unexpectedly invalidated when queried, leading to a re-read from the JDBC table instead of retrieving data from the cache.
> Example SQL:
> {code:java}
> CACHE TABLE cache_t SELECT * FROM mysql.test.test1;
> SELECT * FROM cache_t;
> {code}
> Expected Behavior:
> The expectation is that querying the cached table (cache_t) should retrieve the result from the cache without re-evaluating the execution plan.
> Actual Behavior:
> However, the cache is invalidated, and the content is re-read from the JDBC table.
> Root Cause:
> The issue lies in the 'CacheData' class, where the comparison involves 'JDBCTable.' The 'JDBCTable' is a case class:
> {code:java}
> case class JDBCTable(ident: Identifier, schema: StructType, jdbcOptions: JDBCOptions)
> {code}
> The comparison of non-case class components, such as 'jdbcOptions,' involves pointer comparison. This leads to unnecessary cache invalidation.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org