Codec.map fails for keys of type java.lang.String
Nobody has claimed this yet.
- Dominant language
- Scala
- Stars
- 104
- Forks
- 38
- Avg merge
- 4d 13h
- Merged PRs (30d)
- 12
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in modules/core/src/main/scala/vulcan/Codec.scala around the Codec.map implementation at the referenced line, and trace how map keys are decoded. Update the behavior so keys represented as java.lang.String are accepted alongside Utf8, then verify that deserializing the shown schema no longer raises the unexpected map key exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- data
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 70/100