07ARB opened a new pull request #27024:
URL: https://github.com/apache/spark/pull/27024
### What changes were proposed in this pull request?
lpad and rpad built in function should throw Error or Exception for invalid
length value Instead of empty string.
### Why are the changes needed?
We should throw Error or Exception message, if user trying to perform
LPAD/RPAD operation using invalid argument.
```
SELECT lpad('hi', 'ankit', '?') => "" <previous behaviours>
SELECT lpad('hi', 'ankit', '?') => "Error in query: Invalid argument,
TypeCheckFailure(argument 2 requires int type, however, ''ankit'' is of string
type.);" <After this PR>
SELECT rpad('hi', 'raj', '?') => "" <previous behaviours>
SELECT lpad('hi', 'raj', '?') => "Error in query: Invalid argument,
TypeCheckFailure(argument 2 requires int type, however, ''raj'' is of string
type.);" <After this PR>
```
### Does this PR introduce any user-facing change?
YES




### How was this patch tested?
Added new test case to check invalid length value.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]