Uploaded image for project: 'Apache Avro'
  1. Apache Avro
  2. AVRO-2075

Allow SchemaCompatibility to report possibly lossy conversions

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 1.7.7, 1.8.2
    • None
    • java
    • None

    Description

      It is stated in the Avro spec that int and long values are promotable to floats and doubles.
      However, numeric promotions to floats are lossy (losing precision), as is long promotion to double.
      It is suggested that the SchemaCompatibility class is updated to be able to flag conversions that have the possibility to be lossy as errors. The attached patch does just that, by adding a new boolean flag (allowDataLoss), preserving backwards compatibility by defaulting this flag to true.
      Testcases illustrating the problem has been added to the unit test class TestReadingWritingDataInEvolvedSchemas

      Attachments

        Activity

          People

            epkanol Anders Sundelin
            epkanol Anders Sundelin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: