Skip to content

Remove RecordField position and order #490

Closed

Description

@Kriskras99

Both fields aren't really used in the code, and make the existing code more complex.
order has in its documentation that it is not used.
position is only used in the SchemaAwareWriteSerializer where the value could also have been passed in as a function argument from the parent function.

Needing to fill the position fields make generating code in avro_derive significantly complex. So removing it would simplify a lot of code (we would also need to generate less code which makes T::get_schema() faster at runtime).

@martin-g what do you think?

Activity

  1. Kriskras99 commented on Feb 27, 2026

    @Kriskras99
    ContributorAuthor

    In the same vein, why is aliases a Option<Vec<String>>? All uses if if let Some(aliases) = field.aliases can be replaced by if !field.aliases.is_empty() and an empty Vec does not allocate.

  2. martin-g commented on Feb 27, 2026

    @martin-g
    Member

    order has in its documentation that it is not used.

    https://avro.apache.org/docs/1.12.0/specification/#schema-record says:

    order: specifies how this field impacts sort ordering of this record (optional).
    

    and indeed the Rust SDK does not use it and AFAIR no user ever asked anything about it.
    +1 to remove it!

  3. martin-g commented on Feb 27, 2026

    @martin-g
    Member

    In the same vein, why is aliases a Option<Vec<String>>? All uses if if let Some(aliases) = field.aliases can be replaced by if !field.aliases.is_empty() and an empty Vec does not allocate.

    I think I did it this way because of the optional in aliases: a JSON array of strings, providing alternate names for this field (optional). at https://avro.apache.org/docs/1.12.0/specification/#schema-record
    You are correct that it could be simplified!

    +1 to do it!

  4. martin-g commented on Feb 27, 2026

    @martin-g
    Member

    position is only used in the SchemaAwareWriteSerializer where the value could also have been passed in as a function argument from the parent function.

    There is nothing about it in the spec.
    +1 to remove it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions