dianfu edited a comment on issue #11771: URL: https://github.com/apache/flink/pull/11771#issuecomment-616355772
It's a good idea to add description in the PR commit message and will do that. For this issue itself, I have already explained in the JIRA. Let me try to explain it in the PR again: It's a bug introduced by CALCITE-3149. It ensures that the RelDataType cache (stored in DATATYPE_CACHE) in RelDataTypeFactoryImpl could be garbage collected. However, the equality check still checks the [object reference](https://github.com/apache/calcite/blob/52a57078ba081b24b9d086ed363c715485d1a519/core/src/main/java/org/apache/calcite/rex/RexProgramBuilder.java#L948) instead using `object.equals`. It may cause issues in cases that the cache DATATYPE_CACHE has been garbage collected and at the same time there are still references to the old RelDataType. During debugging this problem, I have saw there are RelDataTypes which are not in the DATATYPE_CACHE cache and this is the root cause of the test failure reported in this JIRA. Theoretically speaking, all the SQL jobs have chances to encounter this bug. We need to fix in the calcite eventually. @danny0405 is already helping on that. Regarding to the fix in this PR, it just adjust the test case a bit to make it doesn't encounter into the bug. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org