Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-13224

TupleTypeInfoBase equals function can't distinguish different struct type

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 1.8.0
    • None
    • None
    • flink 1.8.0

    Description

      Hi

      i have two struct type

      one is

      // code placeholder
      Types.ROW_NAMED(
               new String[]{"device"},
               Types.PRIMITIVE_ARRAY(Types.BYTE)
      
      )
      

      the other is

       

      // code placeholder
      Types.ROW_NAMED(
               new String[]{"app"},
               Types.PRIMITIVE_ARRAY(Types.BYTE)
      
      )
      

      when i compare those two types ,the equals function returns true.

      there are some code in TupleTypeInfoBase         

      // code placeholder
      return other.canEqual(this) &&
                 super.equals(other) &&
             Arrays.equals(types, other.types) &&
             totalFields == other.totalFields;
      

      i think,The equals function should compare field names.

      eg:

      // 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);
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            forideal forideal
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: