07ARB opened a new pull request #27024: [SPARK-29854]lpad and rpad built in 
function should throw Error or Exception for invalid length value
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, ''ankit'' is of string 
type.);"   <After this PR>
   ```
   
   
   ### Does this PR introduce any user-facing change?
   YES
   ![Screenshot 2019-12-27 at 4 09 46 
PM](https://user-images.githubusercontent.com/8948111/71514275-e8577180-28c3-11ea-9d0b-9b4f3027ddeb.png)
   
   ![Screenshot 2019-12-27 at 4 15 55 
PM](https://user-images.githubusercontent.com/8948111/71514356-37050b80-28c4-11ea-87ab-0406db6d720e.png)
   ![Screenshot 2019-12-27 at 4 16 52 
PM](https://user-images.githubusercontent.com/8948111/71514395-674caa00-28c4-11ea-91dc-37c253f451b0.png)
   
   ![Screenshot 2019-12-27 at 4 17 05 
PM](https://user-images.githubusercontent.com/8948111/71514392-5dc34200-28c4-11ea-94bd-70d439c5216f.png)
   
   
   ### How was this patch tested?
   Old unit tests correct as per this jira.
   

----------------------------------------------------------------
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]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to