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

Xin Chen edited comment on CALCITE-5733 at 6/6/23 8:22 AM:
-----------------------------------------------------------

The current solution I can think of is this, as shown in the PR submitted by 
github. I want to return a comparison of "ARRAY"-RexCall-Type. Then, in the 
simplifyAndTerms method, parse the generated comparison with the shape of 
"=($0, ARRAY['111', '222'])" to generate the corresponding array. When it is 
found that the arrays with AND connections are different, immediately generate 
a false literal to achieve the desired simplified operation. That is to say, it 
can simplify “a = ARRAY[1,2] AND a = ARRAY[2,3]” to "false".
 !screenshot-4.png! 

Maybe it is not standard. Thank you for your reply if anybody has better 
suggestions.


was (Author: JIRAUSER298666):
The current solution I can think of is this, as shown in the PR submitted by 
github. I want to return a comparison of "ARRAY"-RexCall-Type. Then, in the 
simplifyAndTerms method, parse the generated comparison with the shape of 
"=($0ARRAY [111222])" to generate the corresponding array. When it is found 
that the arrays with AND connections are different, immediately generate a 
false literal to achieve the desired simplified operation. That is to say, it 
can simplify “a = ARRAY[1,2] AND a = ARRAY[2,3]” to "false".
 !screenshot-4.png! 

Maybe it is not standard. Thank you for your reply if anybody has better 
suggestions.

> simplify should also simplify for array type
> --------------------------------------------
>
>                 Key: CALCITE-5733
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5733
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 1.26.0, 1.34.0
>            Reporter: Xin Chen
>            Priority: Major
>              Labels: pull-request-available
>         Attachments: screenshot-1.png, screenshot-2.png, screenshot-3.png, 
> screenshot-4.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)

Reply via email to