Skip to content

Codec.map fails for keys of type java.lang.String #749

@ilinandrii

Description

@ilinandrii

Problem is similar to #64 but for Codec.map String keys.
Currently keys are only allowed to be of Utf8 type.
I have the following field schema derived from java class generated by avro java plugin:

{
  "name": "recordsMap",
  "type": {
    "type": "map",
    "values": "com.example.MapRecord",
    "avro.java.string": "String"
  }
}

Standard vulcan map codec https://github.com/typelevel/vulcan/blob/main/modules/core/src/main/scala/vulcan/Codec.scala#L889 throws an exception in this case when deserializing a key:

Error decoding Map: Got unexpected map key with type java.lang.String, expected Utf8

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions