[ 
https://issues.apache.org/jira/browse/FLINK-41318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18137931#comment-18137931
 ] 

sepuri sai krishna commented on FLINK-41318:
--------------------------------------------

One question before a PR, because a complete fix is not only a change to the 
function body.

The two API paths declare different return types for {{ASCII}}. The SQL 
operator declares
{{INTEGER}}, the Table API definition declares {{TINYINT}}. A correct value for 
a character outside
US-ASCII does not fit in {{TINYINT}} at all, so fixing only the computation 
leaves the Table API
path still wrong. Widening the declared type to {{INT}} is a user visible 
change and would need a
release note.

Is that widening acceptable? I have the fix and the tests for both parts 
locally and will open a PR
once this is settled and the ticket is assigned. If you would rather keep 
{{TINYINT}}, then the
documented behaviour needs to change instead, and I am happy to do that version.


> ASCII returns a negative number for characters outside US-ASCII
> ---------------------------------------------------------------
>
>                 Key: FLINK-41318
>                 URL: https://issues.apache.org/jira/browse/FLINK-41318
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / Planner
>    Affects Versions: 2.4.0
>            Reporter: sepuri sai krishna
>            Priority: Minor
>
> {{ASCII}} is documented as "Returns the numeric value of the first character 
> of string". For a
> character outside US-ASCII it returns a negative number.
> {code:sql}
> SELECT ASCII('a'), ASCII('é'), ASCII('中');
> {code}
> Returns {{97, -61, -28}}. No character has a negative numeric value. {{CHR}} 
> is documented for 0 to
> 255, so the results cannot be fed back into it either.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to