yisha zhou created FLINK-35827:
----------------------------------

             Summary: Equality bewteen a row field and a row constant is wrong 
in SQL
                 Key: FLINK-35827
                 URL: https://issues.apache.org/jira/browse/FLINK-35827
             Project: Flink
          Issue Type: Bug
          Components: Table SQL / Planner
            Reporter: yisha zhou


To reproduce the issue, you can add codes below in RowTypeTest
{code:java}
testAllApis(
  'f2 === row(2, "foo", true),
  "f2 = row(2, 'foo', true)",
  "true"
) {code}
f2 is actually the same as the constant `row(2, "foo", true)`, however the 
result of expression `f2 = row(2, 'foo', true)`  is false.   

The root cause is that `ScalarOperatorGens.generateEquals` generates code like 
`$leftTerm.equals($rightTerm)` for row types. However f2 may be a 
GenericRowData, the constant may be a BinaryRowData, the equality between them 
are false.
 
And after investigating the code, I believe logic in 
`EqualiserCodeGenerator.generateEqualsCode` can handle the issue here. 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to