kasakrisz commented on a change in pull request #1810:
URL: https://github.com/apache/hive/pull/1810#discussion_r551761602
##########
File path: ql/src/test/queries/clientpositive/udf_trim.q
##########
@@ -1,2 +1,20 @@
DESCRIBE FUNCTION trim;
DESCRIBE FUNCTION EXTENDED trim;
+
+SELECT '"' || trim(' tech ') || '"';
+
+SELECT '"' || TRIM(' ' FROM ' tech ') || '"';
+
+SELECT '"' || TRIM(LEADING '0' FROM '000123') || '"';
+
+SELECT '"' || TRIM(TRAILING '1' FROM 'Tech1') || '"';
+
+SELECT '"' || TRIM(BOTH '1' FROM '123Tech111') || '"';
+
+SELECT '"' || ltrim(' tech ') || '"', '"' || rtrim(' tech ') || '"';
+
+SELECT '"' || lTRIM('0' FROM '000123') || '"', '"' || rTRIM('0' FROM
'000123') || '"';
+
+SELECT trim('000123', '0');
Review comment:
`null` cannot be passed as a parameter to `trim`. It works in Postgres
and Oracle but not supported in Hive.
The following was executed on master without this patch:
```
select trim(null);
org.apache.hadoop.hive.ql.parse.SemanticException: Line 6:7 Wrong arguments
'TOK_NULL': trim takes only STRING/CHAR/VARCHAR types. Found VOID
```
IMHO we can implement this in a follow-up patch.
----------------------------------------------------------------
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]