You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "yisha zhou (Jira)" <ji...@apache.org> on 2024/07/12 08:59:00 UTC

[jira] [Created] (FLINK-35827) Equality bewteen a row field and a row constant is wrong in SQL

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)