expression: Clone scalar function when to check the equivalence of the expression (#64298)

close pingcap/tidb#64156
This commit is contained in:
Weizhen Wang
2025-11-07 14:03:25 +08:00
committed by GitHub
parent 659850df27
commit f6aa990842

View File

@ -404,8 +404,10 @@ func assertCheckHashCode(sf *ScalarFunction) {
intest.Assert(intest.InTest)
copyhashcode := make([]byte, len(sf.hashcode))
copy(copyhashcode, sf.hashcode)
ReHashCode(sf)
intest.Assert(bytes.Equal(sf.hashcode, copyhashcode), "HashCode should not change after ReHashCode is called")
// avoid data race in the plan cache
s := sf.Clone().(*ScalarFunction)
ReHashCode(s)
intest.Assert(bytes.Equal(s.hashcode, copyhashcode), "HashCode should not change after ReHashCode is called")
}
// IsCorrelated implements Expression interface.