You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Allison Portis (Jira)" <ji...@apache.org> on 2022/11/16 04:28:00 UTC

[jira] [Created] (SPARK-41154) Incorrect relation caching for queries with time travel spec

Allison Portis created SPARK-41154:
--------------------------------------

             Summary: Incorrect relation caching for queries with time travel spec
                 Key: SPARK-41154
                 URL: https://issues.apache.org/jira/browse/SPARK-41154
             Project: Spark
          Issue Type: Bug
          Components: SQL
    Affects Versions: 3.3.1, 3.3.0
            Reporter: Allison Portis


[https://github.com/apache/spark/pull/34497] added AS OF syntax support to support time travel queries in SQL. When resolving these [we cache the resolved relation|https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala#L1250] with only the qualified table name as the key, ignoring the time travel spec. Thus any subsequent queries on that table are resolved using the first's time travel spec.

This affects subqueries, CTEs, and temporary views (when created with SQL).

Queries like this will be incorrectly resolved:
{code:sql}
select * from table version as of 1
union all
select * from table version as of 0
{code}
--->
{code:sql}
select * from table version as of 1
union all
select * from table version as of 1
{code}

This was originally reported here https://github.com/delta-io/delta/issues/1479



--
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