linhongliu-db opened a new pull request #32831:
URL: https://github.com/apache/spark/pull/32831


   ### What changes were proposed in this pull request?
   If the user creates a view in 2.4 and reads it in 3.1/3.2, there will be an 
incompatible schema issue.
   So this PR adds a view ddl in the error message to prompt the user 
recreating the view to fix the
   incompatible issue.
   For example:
   ```sql
   -- create view in 2.4
   CREATE TABLE IF NOT EXISTS t USING parquet AS SELECT '1' as a, '20210420' as 
b"
   CREATE OR REPLACE VIEW v AS SELECT CAST(t.a AS INT), to_date(t.b, 
'yyyyMMdd') FROM t
   -- select view in master
   SELECT * FROM v
   ```
   Then we will get below error:
   ```
   Error in SQL statement: AnalysisException: cannot resolve '`to_date(t.`b`, 
'yyyyMMdd')`' given input columns: [a, to_date(b, yyyyMMdd)]
   ```
   
   
   ### Why are the changes needed?
   Improve the error message
   
   
   ### Does this PR introduce _any_ user-facing change?
   Yes, the error message will change
   
   
   ### How was this patch tested?
   not yet
   


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

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



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to