[SPARK-47977] DateTimeUtils.timestampDiff and DateTimeUtils.timestampAdd should not throw INTERNAL_ERROR exception
What changes were proposed in this pull request?
Convert INTERNAL_ERROR for timestampAdd and timestampDiff to error with class. Reusing INVALID_PARAMETER_VALUE.DATETIME_UNIT used when parsing expressions.
The change is needed since timestampDiff and timestampAdd expressions could be constructed without going through parser - e.g. PySpark creates timestampDiff through PythonSQLUtils.
Why are the changes needed?
Correct classification of errors
Does this PR introduce any user-facing change?
No
How was this patch tested?
Existing unit tests updated with new error class
Was this patch authored or co-authored using generative AI tooling?
No
@MaxGekk please take a look
@cloud-fan please review
it has merge conflicts, @vitaliili-db can you fix it?
@cloud-fan done!
Thanks, merging to master