[
https://issues.apache.org/jira/browse/CALCITE-4590?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17355537#comment-17355537
]
duan xiong edited comment on CALCITE-4590 at 6/2/21, 8:52 AM:
--------------------------------------------------------------
I have try to find related issue and add issue Links. and read code about
RelDataTypeSystem looks like only one method about char and varchar convert is:
`shouldConvertRaggedUnionTypesToVarying` and When set
shouldConvertRaggedUnionTypesToVarying is true, make all literal constant are
used as varchar, This result is right(include search in values where
EXPR$1='value' and where EXPR$1='value' or EXPR$1='value2')
was (Author: nobigo):
I have try to find related issue and add issue Links. and read code about
RelDataTypeSystem looks like only one method about char and varchar convert is:
`shouldConvertRaggedUnionTypesToVarying`
> Incorrect query result with fixed-length string
> -----------------------------------------------
>
> Key: CALCITE-4590
> URL: https://issues.apache.org/jira/browse/CALCITE-4590
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.26.0
> Reporter: Roman Kondakov
> Assignee: duan xiong
> Priority: Major
>
> Query may return wrong result when fixed-length strings (CHAR(N)) are used in
> OR/IN clause
> {code:java}
> @Test void test() {
> // Passed.
> CalciteAssert.that()
> .query("select * from (values (1, 'a'), (2, 'abc')) where EXPR$1 =
> 'a'")
> .returns("EXPR$0=1; EXPR$1=a \n");
> // Failed. Only "EXPR$0=2; EXPR$1=abc\n" is returned
> CalciteAssert.that()
> .query("select * from (values (1, 'a'), (2, 'abc')) where EXPR$1 =
> 'a' or EXPR$1 = 'abc'")
> .returns("EXPR$0=1; EXPR$1=a \n"
> + "EXPR$0=2; EXPR$1=abc\n");
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)