[
https://issues.apache.org/jira/browse/CALCITE-5733?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17727467#comment-17727467
]
Xin Chen commented on CALCITE-5733:
-----------------------------------
I found this issue while debugging the Flink SQL task. I roughly understand how
the framework simplifies SQL to verify that a field cannot be equal to two
values and connects them using “AND”.
!screenshot-1.png!
!screenshot-2.png!
Here, an instance of the Comparison class will be created or null will be
returned, but only the “Literal” form is considered, without considering the
existence of the following form for the "operands" of the "RexNode e" passed in:
{code:java}
CAST(ARRAY(_UTF-16LE'ccc.jpg', _UTF-16LE'ddd.jpg')):VARCHAR(2147483647)
CHARACTER SET "UTF-16LE" ARRAY NOT NULL
{code}
So when the array is passed in, null is returned here, but the string correctly
returns an instance of comparison. I think this is a significant difference. In
the subsequent code logic, comparison will be used to verify that a field
cannot be connected to two different values with “AND” in condition.
> simplify should also simplify for array type
> --------------------------------------------
>
> Key: CALCITE-5733
> URL: https://issues.apache.org/jira/browse/CALCITE-5733
> Project: Calcite
> Issue Type: Bug
> Affects Versions: 1.26.0, 1.34.0
> Reporter: Xin Chen
> Priority: Major
> Attachments: screenshot-1.png, screenshot-2.png
>
>
> Simplification seem to not take into account that the specified field is of
> array type. In other words,it can simplify "a = 1 AND a = 2" to "false",but
> can not simplify “a = [1,2] AND a = [2,3]” to "false". Obviously, was there
> no consideration given to the field type being an array?I found this issue
> while debugging the Flink SQL task.
> Link to
> https://issues.apache.org/jira/browse/FLINK-32188.
> https://issues.apache.org/jira/browse/CALCITE-4364
--
This message was sent by Atlassian Jira
(v8.20.10#820010)