You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Robert Metzger (JIRA)" <ji...@apache.org> on 2019/07/15 15:52:00 UTC
[jira] [Updated] (FLINK-13224) TupleTypeInfoBase equals function
can't distinguish different struct type
[ https://issues.apache.org/jira/browse/FLINK-13224?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Robert Metzger updated FLINK-13224:
-----------------------------------
Component/s: API / Type Serialization System
> TupleTypeInfoBase equals function can't distinguish different struct type
> -------------------------------------------------------------------------
>
> Key: FLINK-13224
> URL: https://issues.apache.org/jira/browse/FLINK-13224
> Project: Flink
> Issue Type: Bug
> Components: API / Type Serialization System
> Affects Versions: 1.8.0
> Environment: flink 1.8.0
> Reporter: forideal
> Priority: Major
>
> Hi
> i have two struct type
> one is
> {code:java}
> // code placeholder
> Types.ROW_NAMED(
> new String[]{"device"},
> Types.PRIMITIVE_ARRAY(Types.BYTE)
> )
> {code}
> the other is
>
> {code:java}
> // code placeholder
> Types.ROW_NAMED(
> new String[]{"app"},
> Types.PRIMITIVE_ARRAY(Types.BYTE)
> )
> {code}
> when i compare those two types ,the equals function returns true.
> there are some code in TupleTypeInfoBase
> {code:java}
> // code placeholder
> return other.canEqual(this) &&
> super.equals(other) &&
> Arrays.equals(types, other.types) &&
> totalFields == other.totalFields;
> {code}
> i think,The equals function should compare field names.
> eg:
> {code:java}
> // code placeholder
> if (totalFields == other.totalFields) {
> String[] otherFieldNames = other.getFieldNames();
> String[] fieldNames = this.getFieldNames();
> for (int i = 0; i < totalFields; i++) {
> if (!otherFieldNames[i].equals(fieldNames[i])) {
> return false;
> }
> }
> } else{
> return false;
> }
> return other.canEqual(this) &&
> super.equals(other) &&
> Arrays.equals(types, other.types);
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)