[SPARK-4434] Add a test case as a regression check for SPARK-4434

This PR adds a regression test for SPARK-4434.