You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Jing Zhang (Jira)" <ji...@apache.org> on 2021/11/24 02:43:00 UTC

[jira] [Commented] (CALCITE-4888) Unify type inferring logical for Sarg RexLiteral

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

Jing Zhang commented on CALCITE-4888:
-------------------------------------

[~nobigo] Thanks for your reply. First, I understand your concern, however I think it's not the problem this issue aim to solve.
You could check the following sql behavior. They belongs to same problem which you referred. Whether need to cast type of operands if operands of same SqlFunction or SqlOperator have different types is an important topic. But it is not the purpose which this ticket aims to solve. We could open another JIRA to further discussion (maybe it belongs implicit type conversion). :)

{code:java}
select * from table1 where name = 'xb fadfad'
select * from table1 where name = 'xb'
select * from table1 where name < 'xb'

{code}

This ticket only aims to unify type inferring logical for Sarg RexLiteral.
WDYT, [~nobigo] cc [~julianhyde] [~danny0405]


> Unify type inferring logical for Sarg RexLiteral
> ------------------------------------------------
>
>                 Key: CALCITE-4888
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4888
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: Jing Zhang
>            Priority: Major
>              Labels: pull-request-available
>         Attachments: image-2021-11-23-10-31-05-137.png
>
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> There exists some inconsistency to infer type of Sarg RexLiteral.
> 1. The method `RexSargBuilder#getType` in `RexSimplify` using `rexBuilder.typeFactory.leastRestrictive(Util.distinctList(types));`
> 2. The methods `RexBuilder#makeIn` and `RexBuilder#makeBetween` using type of first ranges as Sarg RexLiteral's type.
> It's better to unify type inferring logical for Sarg RexLiteral.
> IMO, I think using `rexBuilder.typeFactory.leastRestrictive(Util.distinctList(types));` is more reasonable.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)