yihua opened a new pull request, #20849:
URL: https://github.com/apache/hudi/pull/20849

   ### Describe the issue this Pull Request addresses
   
   closes #20826
   
   With the Hudi session extension enabled, `VERSION AS OF` and `TIMESTAMP AS 
OF` on a table that is not a Hudi table fail with 
`INVALID_USAGE_OF_STAR_OR_REGEX`, because the parser rewrites every Spark 
`RelationTimeTravel` into Hudi's `TimeTravelRelation` and only Hudi tables 
resolve it.
   
   ### Summary and Changelog
   
   `TimeTravelRelation` now keeps the relation as parsed, and 
`ResolveReferences` turns the node back into Spark's `RelationTimeTravel` once 
the relation has resolved to a catalog table that is not a Hudi table, so Spark 
handles the time travel as it would without the extension. Hudi tables resolve 
as before, and a CTE reference is not handed back (Spark would look its name up 
in the catalog after CTE substitution). The new case in `TestTimeTravelTable` 
runs `VERSION AS OF`, `TIMESTAMP AS OF` and both inside a CTE against Spark's 
in-memory DSv2 test catalog, and fails on master with the error above. It also 
checks that time travel on a CTE named like a catalog table still fails rather 
than reading that table.
   
   This touches the same import line of `HoodieSparkBaseAnalysis` as #20832, 
and the Hudi `TimeTravelRelation` case that #20334 edits; whichever lands 
second needs a small rebase (the case takes a fourth argument here).
   
   ### Impact
   
   Time travel on non-Hudi tables works in sessions with the Hudi extension. No 
change for Hudi tables.
   
   ### Risk Level
   
   low
   
   ### Documentation Update
   
   none
   
   ### Contributor's checklist
   
   - [ ] Read through [contributor's 
guide](https://hudi.apache.org/contribute/how-to-contribute)
   - [ ] Enough context is provided in the sections above
   - [ ] Adequate tests were added if applicable
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to