You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (Jira)" <ji...@apache.org> on 2023/06/16 06:41:00 UTC

[jira] [Commented] (CALCITE-5777) Simplify 'OperandTypes.STRING.or(OperandTypes.BINARY)' to 'OperandTypes.STRING'

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

Julian Hyde commented on CALCITE-5777:
--------------------------------------

You can imagine how this happened. People naturally think that 'string' in SQL means 'character string' (as it does in Java).

So, fix the problem at its root. Improve the documentation of OperandTypes.STRING. Review places that use OperandTypes.STRING (and similar) and make sure that they intended to include binary strings. Check that such functions are tested with binary strings.

> Simplify 'OperandTypes.STRING.or(OperandTypes.BINARY)' to 'OperandTypes.STRING'
> -------------------------------------------------------------------------------
>
>                 Key: CALCITE-5777
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5777
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Dan Zou
>            Assignee: Dan Zou
>            Priority: Major
>              Labels: pull-request-available
>
> We have used 'OperandTypes.STRING.or(OperandTypes.BINARY)' multiple times as the SqlOperandTypeChecker in 'SqlLibraryOperators'. But this is not reasonable, as the STRING family already contains BINARY family, which means we could simplify 'OperandTypes.STRING.or(OperandTypes.BINARY)' to 'OperandTypes.STRING'.
> {code:java}
>   // From 'SqlTypeName'
>   public static final List<SqlTypeName> STRING_TYPES =
>       combine(CHAR_TYPES, BINARY_TYPES);
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)