refactor: extract assert_optimized_plan_eq from UT.
#4600
Merged
assert_optimized_plan_eq from UT.
#4600