LuciferYang opened a new pull request, #60342:
URL: https://github.com/apache/spark/pull/60342

   ### What changes were proposed in this pull request?
   
   This is a backport of #59545 to `branch-4.3`. See #59545 for the full 
description.
   
   Differences from the `master` commit:
   - `branch-4.3` does not reject a condition that calls a user-defined 
function (SPARK-60777), so such a condition keeps its predicate, as before. 
`CheckConstraint` finds the call itself. A test checks that the predicate is 
kept, in place of the test that ALTER TABLE does not call the function before 
rejecting it.
   - Without `StoredExpressionText` (SPARK-60757), `CheckConstraint` builds the 
same parser settings for the comparison with a write. The test case for 
`spark.sql.legacy.useCurrentConfigsForGeneratedColumn`, which this branch does 
not have, is left out.
   - Without SPARK-60824, `AddCheckConstraint` keeps no analyzed query, so its 
`storeAnalyzedQuery` only makes the decision.
   - The legacy config has version 4.3.1. The migration guide entry is under 
4.3.0 to 4.3.1 and also lists conditions that call a user-defined function.
   
   ### Why are the changes needed?
   
   On `branch-4.3`, `ALTER TABLE ... ADD CONSTRAINT ... CHECK (ts <= 
current_timestamp())` stores a predicate with the time of the ALTER TABLE, so a 
later write that reads the predicate back rejects a row written with the 
current time.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes, the change of #59545, in 4.3.1. The SQL migration guide has an entry 
for it. Setting `spark.sql.legacy.freezeCurrentValuesInCheckConstraint` to 
`true` before adding a constraint stores it as before.
   
   ### How was this patch tested?
   
   The tests of #59545, with the two test changes listed above.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Opus 5.5
   


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


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

Reply via email to