[
https://issues.apache.org/jira/browse/HIVE-24565?focusedWorklogId=531237&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-531237
]
ASF GitHub Bot logged work on HIVE-24565:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 05/Jan/21 14:16
Start Date: 05/Jan/21 14:16
Worklog Time Spent: 10m
Work Description: kasakrisz commented on a change in pull request #1810:
URL: https://github.com/apache/hive/pull/1810#discussion_r551958137
##########
File path:
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFBaseTrim.java
##########
@@ -68,11 +82,24 @@ public Object evaluate(DeferredObject[] arguments) throws
HiveException {
if (valObject == null) {
return null;
}
- String val = ((Text) converter.convert(valObject)).toString();
+ String val = stringToTrimConverter.convert(valObject).toString();
if (val == null) {
return null;
}
- result.set(performOp(val.toString()));
+
+ String trimChars = " ";
Review comment:
I add supporting vectorized two parameter version of trim functions when
the first parameter is a column the second is a literal. Example:
```
create table t1 (col0 string);
select trim(col0, 'xy') from t1 group by col0;
```
In case of trim chars parameter is also column we fall back for
non-vectorized version of trim. I guess this use case is not as common as the
previous but it can be implemented 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]
Issue Time Tracking
-------------------
Worklog Id: (was: 531237)
Time Spent: 50m (was: 40m)
> Implement standard trim function
> --------------------------------
>
> Key: HIVE-24565
> URL: https://issues.apache.org/jira/browse/HIVE-24565
> Project: Hive
> Issue Type: Improvement
> Components: Parser, UDF
> Reporter: Krisztian Kasa
> Assignee: Krisztian Kasa
> Priority: Major
> Labels: pull-request-available
> Time Spent: 50m
> Remaining Estimate: 0h
>
> {code}
> <trim function> ::=
> TRIM <left paren> <trim operands> <right paren>
> <trim operands> ::=
> [ [ <trim specification> ] [ <trim character> ] FROM ] <trim source>
> <trim source> ::=
> <character value expression>
> <trim specification> ::=
> LEADING
> | TRAILING
> | BOTH
> <trim character> ::=
> <character value expression>
> {code}
> Example
> {code}
> SELECT TRIM(LEADING '0' FROM '000123');
> 123
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)