You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Andrew Kenworthy (Created) (JIRA)" <ji...@apache.org> on 2012/03/23 14:21:28 UTC

[jira] [Created] (AVRO-1049) GenericData.Record#equals() does not return false when the schemas are not equal

GenericData.Record#equals() does not return false when the schemas are not equal
--------------------------------------------------------------------------------

                 Key: AVRO-1049
                 URL: https://issues.apache.org/jira/browse/AVRO-1049
             Project: Avro
          Issue Type: Bug
          Components: java
    Affects Versions: 1.6.0
            Reporter: Andrew Kenworthy
            Priority: Minor


This does look like a bug in GenericData.Record#equals().  It should
return false when the schemas are not equal.  It currently only checks
the schema names as a performance optimization; this test code illustrates the issue:

@Test
public void test() {
Schema schema1 = Schema.createRecord("test_record", null, "my.namespace", false);
List<Field> fields1 = new ArrayList<Field>();
fields1.add(new Field("attribute1", Schema.create(Schema.Type.STRING), null, null, Order.IGNORE));
schema1.setFields(fields1);
Schema schema2 = Schema.createRecord("test_record", null, "my.namespace", false);
List<Field> fields2 = new ArrayList<Field>();
fields2.add(new Field("attribute1", Schema.create(Schema.Type.STRING), null, null, Order.ASCENDING));
schema2.setFields(fields2);
GenericRecord record1 = new GenericData.Record(schema1);
record1.put("attribute1", "1");
GenericRecord record2 = new GenericData.Record(schema2);
record2.put("attribute1", "2");
System.out.println(record1.equals(record2)); // returns TRUE
System.out.println(record2.equals(record1)); // returns FALSE
}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (AVRO-1049) GenericData.Record#equals() does not return false when the schemas are not equal

Posted by "Doug Cutting (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AVRO-1049?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Doug Cutting updated AVRO-1049:
-------------------------------

    Fix Version/s: 1.7.0
         Assignee: Doug Cutting
           Status: Patch Available  (was: Open)

I'll commit this soon unless someone objects.
                
> GenericData.Record#equals() does not return false when the schemas are not equal
> --------------------------------------------------------------------------------
>
>                 Key: AVRO-1049
>                 URL: https://issues.apache.org/jira/browse/AVRO-1049
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.6.0
>            Reporter: Andrew Kenworthy
>            Assignee: Doug Cutting
>            Priority: Minor
>             Fix For: 1.7.0
>
>         Attachments: AVRO-1049.patch
>
>
> GenericData.Record#equals() does not return false when the schemas are not equal: it currently only checks
> the schema names as a performance optimization; this test code illustrates the issue:
> {code}
> @Test
> public void test() {
>    Schema schema1 = Schema.createRecord("test_record", null, "my.namespace", false);
>    List<Field> fields1 = new ArrayList<Field>();
>    fields1.add(new Field("attribute1", Schema.create(Schema.Type.STRING), null, null, Order.IGNORE));
>    schema1.setFields(fields1);
>    Schema schema2 = Schema.createRecord("test_record", null, "my.namespace", false);
>    List<Field> fields2 = new ArrayList<Field>();
>    fields2.add(new Field("attribute1", Schema.create(Schema.Type.STRING), null, null, Order.ASCENDING));
>    schema2.setFields(fields2);
>    GenericRecord record1 = new GenericData.Record(schema1);
>    record1.put("attribute1", "1");
>    GenericRecord record2 = new GenericData.Record(schema2);
>    record2.put("attribute1", "2");
>    System.out.println(record1.equals(record2)); // returns TRUE
>    System.out.println(record2.equals(record1)); // returns FALSE
> }
> {code}
> See also:
> http://mail-archives.apache.org/mod_mbox/avro-user/201202.mbox/%3C4F355A77.1070009@apache.org%3E

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (AVRO-1049) GenericData.Record#equals() does not return false when the schemas are not equal

Posted by "Andrew Kenworthy (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AVRO-1049?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrew Kenworthy updated AVRO-1049:
-----------------------------------

    Description: 
GenericData.Record#equals() does not return false when the schemas are not equal: it currently only checks
the schema names as a performance optimization; this test code illustrates the issue:


@Test
public void test() {
Schema schema1 = Schema.createRecord("test_record", null, "my.namespace", false);
List<Field> fields1 = new ArrayList<Field>();
fields1.add(new Field("attribute1", Schema.create(Schema.Type.STRING), null, null, Order.IGNORE));
schema1.setFields(fields1);
Schema schema2 = Schema.createRecord("test_record", null, "my.namespace", false);
List<Field> fields2 = new ArrayList<Field>();
fields2.add(new Field("attribute1", Schema.create(Schema.Type.STRING), null, null, Order.ASCENDING));
schema2.setFields(fields2);
GenericRecord record1 = new GenericData.Record(schema1);
record1.put("attribute1", "1");
GenericRecord record2 = new GenericData.Record(schema2);
record2.put("attribute1", "2");
System.out.println(record1.equals(record2)); // returns TRUE
System.out.println(record2.equals(record1)); // returns FALSE
}

See also:

http://mail-archives.apache.org/mod_mbox/avro-user/201202.mbox/%3C4F355A77.1070009@apache.org%3E

  was:
GenericData.Record#equals() does not return false when the schemas are not equal: it currently only checks
the schema names as a performance optimization; this test code illustrates the issue:

{quote}
@Test
public void test() {
Schema schema1 = Schema.createRecord("test_record", null, "my.namespace", false);
List<Field> fields1 = new ArrayList<Field>();
fields1.add(new Field("attribute1", Schema.create(Schema.Type.STRING), null, null, Order.IGNORE));
schema1.setFields(fields1);
Schema schema2 = Schema.createRecord("test_record", null, "my.namespace", false);
List<Field> fields2 = new ArrayList<Field>();
fields2.add(new Field("attribute1", Schema.create(Schema.Type.STRING), null, null, Order.ASCENDING));
schema2.setFields(fields2);
GenericRecord record1 = new GenericData.Record(schema1);
record1.put("attribute1", "1");
GenericRecord record2 = new GenericData.Record(schema2);
record2.put("attribute1", "2");
System.out.println(record1.equals(record2)); // returns TRUE
System.out.println(record2.equals(record1)); // returns FALSE
}
{quote}

See also:

http://mail-archives.apache.org/mod_mbox/avro-user/201202.mbox/%3C4F355A77.1070009@apache.org%3E

    
> GenericData.Record#equals() does not return false when the schemas are not equal
> --------------------------------------------------------------------------------
>
>                 Key: AVRO-1049
>                 URL: https://issues.apache.org/jira/browse/AVRO-1049
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.6.0
>            Reporter: Andrew Kenworthy
>            Priority: Minor
>
> GenericData.Record#equals() does not return false when the schemas are not equal: it currently only checks
> the schema names as a performance optimization; this test code illustrates the issue:
> @Test
> public void test() {
> Schema schema1 = Schema.createRecord("test_record", null, "my.namespace", false);
> List<Field> fields1 = new ArrayList<Field>();
> fields1.add(new Field("attribute1", Schema.create(Schema.Type.STRING), null, null, Order.IGNORE));
> schema1.setFields(fields1);
> Schema schema2 = Schema.createRecord("test_record", null, "my.namespace", false);
> List<Field> fields2 = new ArrayList<Field>();
> fields2.add(new Field("attribute1", Schema.create(Schema.Type.STRING), null, null, Order.ASCENDING));
> schema2.setFields(fields2);
> GenericRecord record1 = new GenericData.Record(schema1);
> record1.put("attribute1", "1");
> GenericRecord record2 = new GenericData.Record(schema2);
> record2.put("attribute1", "2");
> System.out.println(record1.equals(record2)); // returns TRUE
> System.out.println(record2.equals(record1)); // returns FALSE
> }
> See also:
> http://mail-archives.apache.org/mod_mbox/avro-user/201202.mbox/%3C4F355A77.1070009@apache.org%3E

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (AVRO-1049) GenericData.Record#equals() does not return false when the schemas are not equal

Posted by "Andrew Kenworthy (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AVRO-1049?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrew Kenworthy updated AVRO-1049:
-----------------------------------

    Description: 
GenericData.Record#equals() does not return false when the schemas are not equal: it currently only checks
the schema names as a performance optimization; this test code illustrates the issue:

{code}
@Test
public void test() {
Schema schema1 = Schema.createRecord("test_record", null, "my.namespace", false);
List<Field> fields1 = new ArrayList<Field>();
fields1.add(new Field("attribute1", Schema.create(Schema.Type.STRING), null, null, Order.IGNORE));
schema1.setFields(fields1);
Schema schema2 = Schema.createRecord("test_record", null, "my.namespace", false);
List<Field> fields2 = new ArrayList<Field>();
fields2.add(new Field("attribute1", Schema.create(Schema.Type.STRING), null, null, Order.ASCENDING));
schema2.setFields(fields2);
GenericRecord record1 = new GenericData.Record(schema1);
record1.put("attribute1", "1");
GenericRecord record2 = new GenericData.Record(schema2);
record2.put("attribute1", "2");
System.out.println(record1.equals(record2)); // returns TRUE
System.out.println(record2.equals(record1)); // returns FALSE
}
{code}

See also:

http://mail-archives.apache.org/mod_mbox/avro-user/201202.mbox/%3C4F355A77.1070009@apache.org%3E

  was:
GenericData.Record#equals() does not return false when the schemas are not equal: it currently only checks
the schema names as a performance optimization; this test code illustrates the issue:


@Test
public void test() {
Schema schema1 = Schema.createRecord("test_record", null, "my.namespace", false);
List<Field> fields1 = new ArrayList<Field>();
fields1.add(new Field("attribute1", Schema.create(Schema.Type.STRING), null, null, Order.IGNORE));
schema1.setFields(fields1);
Schema schema2 = Schema.createRecord("test_record", null, "my.namespace", false);
List<Field> fields2 = new ArrayList<Field>();
fields2.add(new Field("attribute1", Schema.create(Schema.Type.STRING), null, null, Order.ASCENDING));
schema2.setFields(fields2);
GenericRecord record1 = new GenericData.Record(schema1);
record1.put("attribute1", "1");
GenericRecord record2 = new GenericData.Record(schema2);
record2.put("attribute1", "2");
System.out.println(record1.equals(record2)); // returns TRUE
System.out.println(record2.equals(record1)); // returns FALSE
}

See also:

http://mail-archives.apache.org/mod_mbox/avro-user/201202.mbox/%3C4F355A77.1070009@apache.org%3E

    
> GenericData.Record#equals() does not return false when the schemas are not equal
> --------------------------------------------------------------------------------
>
>                 Key: AVRO-1049
>                 URL: https://issues.apache.org/jira/browse/AVRO-1049
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.6.0
>            Reporter: Andrew Kenworthy
>            Priority: Minor
>
> GenericData.Record#equals() does not return false when the schemas are not equal: it currently only checks
> the schema names as a performance optimization; this test code illustrates the issue:
> {code}
> @Test
> public void test() {
> Schema schema1 = Schema.createRecord("test_record", null, "my.namespace", false);
> List<Field> fields1 = new ArrayList<Field>();
> fields1.add(new Field("attribute1", Schema.create(Schema.Type.STRING), null, null, Order.IGNORE));
> schema1.setFields(fields1);
> Schema schema2 = Schema.createRecord("test_record", null, "my.namespace", false);
> List<Field> fields2 = new ArrayList<Field>();
> fields2.add(new Field("attribute1", Schema.create(Schema.Type.STRING), null, null, Order.ASCENDING));
> schema2.setFields(fields2);
> GenericRecord record1 = new GenericData.Record(schema1);
> record1.put("attribute1", "1");
> GenericRecord record2 = new GenericData.Record(schema2);
> record2.put("attribute1", "2");
> System.out.println(record1.equals(record2)); // returns TRUE
> System.out.println(record2.equals(record1)); // returns FALSE
> }
> {code}
> See also:
> http://mail-archives.apache.org/mod_mbox/avro-user/201202.mbox/%3C4F355A77.1070009@apache.org%3E

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (AVRO-1049) GenericData.Record#equals() does not return false when the schemas are not equal

Posted by "Doug Cutting (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AVRO-1049?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Doug Cutting updated AVRO-1049:
-------------------------------

    Resolution: Fixed
        Status: Resolved  (was: Patch Available)

I committed this.
                
> GenericData.Record#equals() does not return false when the schemas are not equal
> --------------------------------------------------------------------------------
>
>                 Key: AVRO-1049
>                 URL: https://issues.apache.org/jira/browse/AVRO-1049
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.6.0
>            Reporter: Andrew Kenworthy
>            Assignee: Doug Cutting
>            Priority: Minor
>             Fix For: 1.7.0
>
>         Attachments: AVRO-1049.patch
>
>
> GenericData.Record#equals() does not return false when the schemas are not equal: it currently only checks
> the schema names as a performance optimization; this test code illustrates the issue:
> {code}
> @Test
> public void test() {
>    Schema schema1 = Schema.createRecord("test_record", null, "my.namespace", false);
>    List<Field> fields1 = new ArrayList<Field>();
>    fields1.add(new Field("attribute1", Schema.create(Schema.Type.STRING), null, null, Order.IGNORE));
>    schema1.setFields(fields1);
>    Schema schema2 = Schema.createRecord("test_record", null, "my.namespace", false);
>    List<Field> fields2 = new ArrayList<Field>();
>    fields2.add(new Field("attribute1", Schema.create(Schema.Type.STRING), null, null, Order.ASCENDING));
>    schema2.setFields(fields2);
>    GenericRecord record1 = new GenericData.Record(schema1);
>    record1.put("attribute1", "1");
>    GenericRecord record2 = new GenericData.Record(schema2);
>    record2.put("attribute1", "2");
>    System.out.println(record1.equals(record2)); // returns TRUE
>    System.out.println(record2.equals(record1)); // returns FALSE
> }
> {code}
> See also:
> http://mail-archives.apache.org/mod_mbox/avro-user/201202.mbox/%3C4F355A77.1070009@apache.org%3E

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (AVRO-1049) GenericData.Record#equals() does not return false when the schemas are not equal

Posted by "Doug Cutting (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AVRO-1049?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Doug Cutting updated AVRO-1049:
-------------------------------

    Attachment: AVRO-1049.patch

Here's a patch that fixes this.
                
> GenericData.Record#equals() does not return false when the schemas are not equal
> --------------------------------------------------------------------------------
>
>                 Key: AVRO-1049
>                 URL: https://issues.apache.org/jira/browse/AVRO-1049
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.6.0
>            Reporter: Andrew Kenworthy
>            Priority: Minor
>             Fix For: 1.7.0
>
>         Attachments: AVRO-1049.patch
>
>
> GenericData.Record#equals() does not return false when the schemas are not equal: it currently only checks
> the schema names as a performance optimization; this test code illustrates the issue:
> {code}
> @Test
> public void test() {
>    Schema schema1 = Schema.createRecord("test_record", null, "my.namespace", false);
>    List<Field> fields1 = new ArrayList<Field>();
>    fields1.add(new Field("attribute1", Schema.create(Schema.Type.STRING), null, null, Order.IGNORE));
>    schema1.setFields(fields1);
>    Schema schema2 = Schema.createRecord("test_record", null, "my.namespace", false);
>    List<Field> fields2 = new ArrayList<Field>();
>    fields2.add(new Field("attribute1", Schema.create(Schema.Type.STRING), null, null, Order.ASCENDING));
>    schema2.setFields(fields2);
>    GenericRecord record1 = new GenericData.Record(schema1);
>    record1.put("attribute1", "1");
>    GenericRecord record2 = new GenericData.Record(schema2);
>    record2.put("attribute1", "2");
>    System.out.println(record1.equals(record2)); // returns TRUE
>    System.out.println(record2.equals(record1)); // returns FALSE
> }
> {code}
> See also:
> http://mail-archives.apache.org/mod_mbox/avro-user/201202.mbox/%3C4F355A77.1070009@apache.org%3E

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (AVRO-1049) GenericData.Record#equals() does not return false when the schemas are not equal

Posted by "Andrew Kenworthy (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AVRO-1049?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrew Kenworthy updated AVRO-1049:
-----------------------------------

    Description: 
GenericData.Record#equals() does not return false when the schemas are not equal: it currently only checks
the schema names as a performance optimization; this test code illustrates the issue:

@Test
public void test() {
Schema schema1 = Schema.createRecord("test_record", null, "my.namespace", false);
List<Field> fields1 = new ArrayList<Field>();
fields1.add(new Field("attribute1", Schema.create(Schema.Type.STRING), null, null, Order.IGNORE));
schema1.setFields(fields1);
Schema schema2 = Schema.createRecord("test_record", null, "my.namespace", false);
List<Field> fields2 = new ArrayList<Field>();
fields2.add(new Field("attribute1", Schema.create(Schema.Type.STRING), null, null, Order.ASCENDING));
schema2.setFields(fields2);
GenericRecord record1 = new GenericData.Record(schema1);
record1.put("attribute1", "1");
GenericRecord record2 = new GenericData.Record(schema2);
record2.put("attribute1", "2");
System.out.println(record1.equals(record2)); // returns TRUE
System.out.println(record2.equals(record1)); // returns FALSE
}

See also:

http://mail-archives.apache.org/mod_mbox/avro-user/201202.mbox/%3C4F355A77.1070009@apache.org%3E

  was:
This does look like a bug in GenericData.Record#equals().  It should
return false when the schemas are not equal.  It currently only checks
the schema names as a performance optimization; this test code illustrates the issue:

@Test
public void test() {
Schema schema1 = Schema.createRecord("test_record", null, "my.namespace", false);
List<Field> fields1 = new ArrayList<Field>();
fields1.add(new Field("attribute1", Schema.create(Schema.Type.STRING), null, null, Order.IGNORE));
schema1.setFields(fields1);
Schema schema2 = Schema.createRecord("test_record", null, "my.namespace", false);
List<Field> fields2 = new ArrayList<Field>();
fields2.add(new Field("attribute1", Schema.create(Schema.Type.STRING), null, null, Order.ASCENDING));
schema2.setFields(fields2);
GenericRecord record1 = new GenericData.Record(schema1);
record1.put("attribute1", "1");
GenericRecord record2 = new GenericData.Record(schema2);
record2.put("attribute1", "2");
System.out.println(record1.equals(record2)); // returns TRUE
System.out.println(record2.equals(record1)); // returns FALSE
}

    
> GenericData.Record#equals() does not return false when the schemas are not equal
> --------------------------------------------------------------------------------
>
>                 Key: AVRO-1049
>                 URL: https://issues.apache.org/jira/browse/AVRO-1049
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.6.0
>            Reporter: Andrew Kenworthy
>            Priority: Minor
>
> GenericData.Record#equals() does not return false when the schemas are not equal: it currently only checks
> the schema names as a performance optimization; this test code illustrates the issue:
> @Test
> public void test() {
> Schema schema1 = Schema.createRecord("test_record", null, "my.namespace", false);
> List<Field> fields1 = new ArrayList<Field>();
> fields1.add(new Field("attribute1", Schema.create(Schema.Type.STRING), null, null, Order.IGNORE));
> schema1.setFields(fields1);
> Schema schema2 = Schema.createRecord("test_record", null, "my.namespace", false);
> List<Field> fields2 = new ArrayList<Field>();
> fields2.add(new Field("attribute1", Schema.create(Schema.Type.STRING), null, null, Order.ASCENDING));
> schema2.setFields(fields2);
> GenericRecord record1 = new GenericData.Record(schema1);
> record1.put("attribute1", "1");
> GenericRecord record2 = new GenericData.Record(schema2);
> record2.put("attribute1", "2");
> System.out.println(record1.equals(record2)); // returns TRUE
> System.out.println(record2.equals(record1)); // returns FALSE
> }
> See also:
> http://mail-archives.apache.org/mod_mbox/avro-user/201202.mbox/%3C4F355A77.1070009@apache.org%3E

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (AVRO-1049) GenericData.Record#equals() does not return false when the schemas are not equal

Posted by "Andrew Kenworthy (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AVRO-1049?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrew Kenworthy updated AVRO-1049:
-----------------------------------

    Description: 
GenericData.Record#equals() does not return false when the schemas are not equal: it currently only checks
the schema names as a performance optimization; this test code illustrates the issue:

{code}
@Test
public void test() {
   Schema schema1 = Schema.createRecord("test_record", null, "my.namespace", false);
   List<Field> fields1 = new ArrayList<Field>();
   fields1.add(new Field("attribute1", Schema.create(Schema.Type.STRING), null, null, Order.IGNORE));
   schema1.setFields(fields1);

   Schema schema2 = Schema.createRecord("test_record", null, "my.namespace", false);
   List<Field> fields2 = new ArrayList<Field>();
   fields2.add(new Field("attribute1", Schema.create(Schema.Type.STRING), null, null, Order.ASCENDING));
   schema2.setFields(fields2);

   GenericRecord record1 = new GenericData.Record(schema1);
   record1.put("attribute1", "1");

   GenericRecord record2 = new GenericData.Record(schema2);
   record2.put("attribute1", "2");

   System.out.println(record1.equals(record2)); // returns TRUE
   System.out.println(record2.equals(record1)); // returns FALSE
}
{code}

See also:

http://mail-archives.apache.org/mod_mbox/avro-user/201202.mbox/%3C4F355A77.1070009@apache.org%3E

  was:
GenericData.Record#equals() does not return false when the schemas are not equal: it currently only checks
the schema names as a performance optimization; this test code illustrates the issue:

{code}
@Test
public void test() {
Schema schema1 = Schema.createRecord("test_record", null, "my.namespace", false);
List<Field> fields1 = new ArrayList<Field>();
fields1.add(new Field("attribute1", Schema.create(Schema.Type.STRING), null, null, Order.IGNORE));
schema1.setFields(fields1);
Schema schema2 = Schema.createRecord("test_record", null, "my.namespace", false);
List<Field> fields2 = new ArrayList<Field>();
fields2.add(new Field("attribute1", Schema.create(Schema.Type.STRING), null, null, Order.ASCENDING));
schema2.setFields(fields2);
GenericRecord record1 = new GenericData.Record(schema1);
record1.put("attribute1", "1");
GenericRecord record2 = new GenericData.Record(schema2);
record2.put("attribute1", "2");
System.out.println(record1.equals(record2)); // returns TRUE
System.out.println(record2.equals(record1)); // returns FALSE
}
{code}

See also:

http://mail-archives.apache.org/mod_mbox/avro-user/201202.mbox/%3C4F355A77.1070009@apache.org%3E

    
> GenericData.Record#equals() does not return false when the schemas are not equal
> --------------------------------------------------------------------------------
>
>                 Key: AVRO-1049
>                 URL: https://issues.apache.org/jira/browse/AVRO-1049
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.6.0
>            Reporter: Andrew Kenworthy
>            Priority: Minor
>
> GenericData.Record#equals() does not return false when the schemas are not equal: it currently only checks
> the schema names as a performance optimization; this test code illustrates the issue:
> {code}
> @Test
> public void test() {
>    Schema schema1 = Schema.createRecord("test_record", null, "my.namespace", false);
>    List<Field> fields1 = new ArrayList<Field>();
>    fields1.add(new Field("attribute1", Schema.create(Schema.Type.STRING), null, null, Order.IGNORE));
>    schema1.setFields(fields1);
>    Schema schema2 = Schema.createRecord("test_record", null, "my.namespace", false);
>    List<Field> fields2 = new ArrayList<Field>();
>    fields2.add(new Field("attribute1", Schema.create(Schema.Type.STRING), null, null, Order.ASCENDING));
>    schema2.setFields(fields2);
>    GenericRecord record1 = new GenericData.Record(schema1);
>    record1.put("attribute1", "1");
>    GenericRecord record2 = new GenericData.Record(schema2);
>    record2.put("attribute1", "2");
>    System.out.println(record1.equals(record2)); // returns TRUE
>    System.out.println(record2.equals(record1)); // returns FALSE
> }
> {code}
> See also:
> http://mail-archives.apache.org/mod_mbox/avro-user/201202.mbox/%3C4F355A77.1070009@apache.org%3E

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (AVRO-1049) GenericData.Record#equals() does not return false when the schemas are not equal

Posted by "Andrew Kenworthy (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AVRO-1049?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrew Kenworthy updated AVRO-1049:
-----------------------------------

    Description: 
GenericData.Record#equals() does not return false when the schemas are not equal: it currently only checks
the schema names as a performance optimization; this test code illustrates the issue:

{quote}
@Test
public void test() {
Schema schema1 = Schema.createRecord("test_record", null, "my.namespace", false);
List<Field> fields1 = new ArrayList<Field>();
fields1.add(new Field("attribute1", Schema.create(Schema.Type.STRING), null, null, Order.IGNORE));
schema1.setFields(fields1);
Schema schema2 = Schema.createRecord("test_record", null, "my.namespace", false);
List<Field> fields2 = new ArrayList<Field>();
fields2.add(new Field("attribute1", Schema.create(Schema.Type.STRING), null, null, Order.ASCENDING));
schema2.setFields(fields2);
GenericRecord record1 = new GenericData.Record(schema1);
record1.put("attribute1", "1");
GenericRecord record2 = new GenericData.Record(schema2);
record2.put("attribute1", "2");
System.out.println(record1.equals(record2)); // returns TRUE
System.out.println(record2.equals(record1)); // returns FALSE
}
{quote}

See also:

http://mail-archives.apache.org/mod_mbox/avro-user/201202.mbox/%3C4F355A77.1070009@apache.org%3E

  was:
GenericData.Record#equals() does not return false when the schemas are not equal: it currently only checks
the schema names as a performance optimization; this test code illustrates the issue:

@Test
public void test() {
Schema schema1 = Schema.createRecord("test_record", null, "my.namespace", false);
List<Field> fields1 = new ArrayList<Field>();
fields1.add(new Field("attribute1", Schema.create(Schema.Type.STRING), null, null, Order.IGNORE));
schema1.setFields(fields1);
Schema schema2 = Schema.createRecord("test_record", null, "my.namespace", false);
List<Field> fields2 = new ArrayList<Field>();
fields2.add(new Field("attribute1", Schema.create(Schema.Type.STRING), null, null, Order.ASCENDING));
schema2.setFields(fields2);
GenericRecord record1 = new GenericData.Record(schema1);
record1.put("attribute1", "1");
GenericRecord record2 = new GenericData.Record(schema2);
record2.put("attribute1", "2");
System.out.println(record1.equals(record2)); // returns TRUE
System.out.println(record2.equals(record1)); // returns FALSE
}

See also:

http://mail-archives.apache.org/mod_mbox/avro-user/201202.mbox/%3C4F355A77.1070009@apache.org%3E

    
> GenericData.Record#equals() does not return false when the schemas are not equal
> --------------------------------------------------------------------------------
>
>                 Key: AVRO-1049
>                 URL: https://issues.apache.org/jira/browse/AVRO-1049
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.6.0
>            Reporter: Andrew Kenworthy
>            Priority: Minor
>
> GenericData.Record#equals() does not return false when the schemas are not equal: it currently only checks
> the schema names as a performance optimization; this test code illustrates the issue:
> {quote}
> @Test
> public void test() {
> Schema schema1 = Schema.createRecord("test_record", null, "my.namespace", false);
> List<Field> fields1 = new ArrayList<Field>();
> fields1.add(new Field("attribute1", Schema.create(Schema.Type.STRING), null, null, Order.IGNORE));
> schema1.setFields(fields1);
> Schema schema2 = Schema.createRecord("test_record", null, "my.namespace", false);
> List<Field> fields2 = new ArrayList<Field>();
> fields2.add(new Field("attribute1", Schema.create(Schema.Type.STRING), null, null, Order.ASCENDING));
> schema2.setFields(fields2);
> GenericRecord record1 = new GenericData.Record(schema1);
> record1.put("attribute1", "1");
> GenericRecord record2 = new GenericData.Record(schema2);
> record2.put("attribute1", "2");
> System.out.println(record1.equals(record2)); // returns TRUE
> System.out.println(record2.equals(record1)); // returns FALSE
> }
> {quote}
> See also:
> http://mail-archives.apache.org/mod_mbox/avro-user/201202.mbox/%3C4F355A77.1070009@apache.org%3E

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira