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

Tolerate any Number when writing primitive values in Java in GenericDatumWriter

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.10.0
    • java
    • None

    Description

      Tolerating any Number (instead of concrete Long, Double, Float) makes possible to use mutable Number implmentation for performance reasons (specially for primitive collection iterations)
      Currently, this only works for int only:

            // Here it works
            case INT:     out.writeInt(((Number)datum).intValue()); break;
            // This should be replaced with ((Number)datum).longValue() etc
            case LONG:    out.writeLong((Long)datum);       break;
            case FLOAT:   out.writeFloat((Float)datum);     break;
            case DOUBLE:  out.writeDouble((Double)datum);   break;
      

      Attachments

        Issue Links

          Activity

            People

              rabikumar.kc Rabi Kumar K C
              dguitelson Daniil Gitelson
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: