You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "forideal (JIRA)" <ji...@apache.org> on 2019/07/11 12:48:00 UTC

[jira] [Created] (FLINK-13224) TupleTypeInfoBase equals function can't distinguish different struct type

forideal created FLINK-13224:
--------------------------------

             Summary: 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
    Affects Versions: 1.8.0
         Environment: flink 1.8.0
            Reporter: forideal


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)