[SPARK-3736] Addressing PR comment to make some defs private.