[
https://issues.apache.org/jira/browse/CALCITE-3005?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16853914#comment-16853914
]
Julian Hyde commented on CALCITE-3005:
--------------------------------------
* A lot of duplication: LEFT and RIGHT functions are virtually identical. I'd
get rid of SqlLeftFunction and SqlRightFunction classes.
* The return type should not be VARCHAR(2000). It should be the same as the
first operand.
* Should LEFT and RIGHT also operate on binary strings?
* Since LEFT and RIGHT have ordinary function syntax, could we just have a
special-case for the function name (allowing LEFT and RIGHT to be converted to
identifier if they occur in a place that a function name could occur), but then
use the usual parsing logic for a function call. In other words, I don't think
LeftFunctionCall() and RightFunctionCall() are necessary. And the parser should
not reference SqlStdOperatorTable.LEFT. Just return an unresolved function call.
> Implement string functions: LEFT, RIGHT
> ---------------------------------------
>
> Key: CALCITE-3005
> URL: https://issues.apache.org/jira/browse/CALCITE-3005
> Project: Calcite
> Issue Type: New Feature
> Reporter: Forward Xu
> Assignee: Forward Xu
> Priority: Major
> Labels: pull-request-available
> Time Spent: 6h 40m
> Remaining Estimate: 0h
>
> Some string functions including LEFT, RIGHT are not implemented now. It would
> be great if these functions can be implemented.
> [{{LEFT(_str_}},_{{len}}_)|https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_left]
> Returns the leftmost _{{len}}_ characters from the string _{{str}}_, or
> {{NULL}} if any argument is {{NULL}}.
> [{{RIGHT(_str_}},_{{len}}_)|https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_right]
> Returns the rightmost _{{len}}_ characters from the string _{{str}}_, or
> {{NULL}} if any argument is {{NULL}}.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)