[
https://issues.apache.org/jira/browse/CALCITE-4912?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
xiong duan updated CALCITE-4912:
--------------------------------
Labels: pull-request-available (was: )
> Confusing javadoc of RexSimplify.simplify
> -----------------------------------------
>
> Key: CALCITE-4912
> URL: https://issues.apache.org/jira/browse/CALCITE-4912
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.28.0
> Reporter: Alexander Trushev
> Assignee: xiong duan
> Priority: Minor
> Labels: pull-request-available
>
> Javadoc of RexSimplify.simplify says that
> {code}
> simplify(x = 1 AND y = 2 AND NOT x = 1) returns y = 2
> {code}
> but it is wrong for any policy:
> x <- 1
> y <- 2
> x = 1 AND y = 2 AND NOT x = 1 == false
> y = 2 == true
> I guess it should have been like
> {code}
> simplify(y = 2 AND (x = 1 OR NOT x = 1 OR x IS NULL)) returns y = 2
> {code}
> which is true for any policy:
> {code}
> Origin: AND(=($1, CAST(2):INTEGER), OR(=($0, CAST(1):INTEGER),
> NOT(=($0, CAST(1):INTEGER)), IS NULL($0)))
> Simplify(Unknown): =($1, 2)
> Simplify(False): =($1, 2)
> Simplify(True): =($1, 2)
> {code}
--
This message was sent by Atlassian Jira
(v8.20.1#820001)