My feeling is that Impala should implement the standard, including the
additional syntax.

On Thu, Jul 7, 2016 at 5:56 PM, Wang, Youwei A <[email protected]> wrote:
> Greetings everyone.
> I am working on the JIRA IMPALA-889: Add support for ISO-SQL trim().
> Corresponding JIRA link: http://issues.cloudera.org/browse/IMPALA-889
>
> I found some ISO-SQL standard at this link: 
> http://troels.arvin.dk/db/rdbms/#functions-TRIM
> For your convenience, I transcript some critical part as following:
>
> Core SQL feature ID E021-09: TRIM(where characters FROM string_to_be_trimmed)
> where may be one of LEADING, TRAILING or BOTH-or omitted which implies BOTH.
> characters indicates what character(s) to remove from the head and/or tail of 
> the string.
> It may be omitted which implies the value ' ' (space character).
> In other words, the shortest form is TRIM(string_to_be_trimmed) which in 
> effect means TRIM(BOTH ' ' FROM string_to_be_trimmed).
> Trimming NULL returns NULL.
>
> I have implemented one single UDF in the following form:
> https://gerrit.cloudera.org/#/c/3213/
> select trim(option, chars_to_trim, source_string);
>
> According that SQL standard, there exists a SQL keyword "FROM" in the 
> function parameter, which means we should modify the Impala SQL parser if we 
> want to follow that definition strictly. This may make situation more complex.
>
> If you have any idea about this, would you please share it with me?
> Thank you! :)

Reply via email to