[ https://issues.apache.org/jira/browse/FLINK-13224?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Timo Walther closed FLINK-13224. -------------------------------- Resolution: Duplicate This is a duplicate of FLINK-12848. Let's continue the discussion there. > 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 (v8.3.4#803005)