[
https://issues.apache.org/jira/browse/CALCITE-6993?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17948382#comment-17948382
]
Stamatis Zampetakis commented on CALCITE-6993:
----------------------------------------------
The redundancy issue is not specific to collections and it appears on many
types. The RelOptRulesTests has many examples:
{noformat}
SEARCH(CAST($3):DECIMAL(11, 1), Sarg[[10.0:DECIMAL(11, 1)..20.0:DECIMAL(11,
1)]]:DECIMAL(11, 1))
SEARCH($1, Sarg[(-∞..'a':VARCHAR(20)), ('a':VARCHAR(20)..'bb':VARCHAR(20)),
('bb':VARCHAR(20)..'cc':VARCHAR(20)), ('cc':VARCHAR(20)..+∞)]:VARCHAR(20))
SEARCH($5, Sarg[(-∞..120], [3000..+∞)])
SEARCH($10, Sarg[(-∞..'a':VARCHAR(20)), ('a':VARCHAR(20)..'bb':VARCHAR(20)),
('bb':VARCHAR(20)..'cc':VARCHAR(20)), ('cc':VARCHAR(20)..+∞)]:VARCHAR(20))
{noformat}
Since Sargs are supposed to contain ranges of the same type I don't know if we
gain something by repeating the type for each value/literal. At first sight it
really seems redundant and I guess we could just keep with the overall type of
the Sarg at the end. I will change the summary of the ticket to make it a bit
more general.
[~mbudiu] , if by breaking tests you mean that we need to update the toString
representation then I believe its fine; we have done it quite a few times in
the past. Since we are talking about a digest we have to ensure though that we
don't accidentally affect correctness.
> Enhance the digest of Sarg to show whether the collection type is nullable
> --------------------------------------------------------------------------
>
> Key: CALCITE-6993
> URL: https://issues.apache.org/jira/browse/CALCITE-6993
> Project: Calcite
> Issue Type: Bug
> Reporter: xiong duan
> Priority: Major
>
> The issue was discovered at [https://github.com/apache/calcite/pull/4345.]
> For example in unit test testMakeInReturnsSearchForArrayLiterals:
> {code:java}
> [100:INTEGER, 200:INTEGER]:INTEGER NOT NULL ARRAY,[300:INTEGER,
> 400:INTEGER]:INTEGER NOT NULL ARRAY]:INTEGER NOT NULL ARRAY
> Can be simplified to:
> [100, 200],[300, 400]:INTEGER NOT NULL ARRAY NOT NULL{code}
> 1: The repeated element types do not necessarily need to be output.
> 2: It is necessary to add the nullable information output for the Array.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)