Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Map support in Avro compiled semantics plugin #151

Open
deaktator opened this issue Apr 12, 2017 · 0 comments
Open

Add Map support in Avro compiled semantics plugin #151

deaktator opened this issue Apr 12, 2017 · 0 comments

Comments

@deaktator
Copy link
Contributor

Allow map variables to be extracted as final field in a variable path. Currently, nothing should be allowed to come after a Map object.

Based on the Avro map spec , only maps with string based keys are allowed. Most likely, these Strings are actually Utf8 instances and the Maps are probably java.util.Map instances. These should be turned into Scala Maps with some function like:

def toMap[V](m: java.util.Map[Utf8, V]): Map[String, V] = ???

Example Avro Protocol (example.avpr)

{
  "namespace": "a.b",
  "protocol": "Example",
  "doc": "Example protocol",
  "types": [
    { "name": "X", "type": "record",
      "fields": [ { "name": "m", "type": {"type": "map", "values": "long"} } ]
    },
    { "name": "Msg", "type": "record",
      "fields": [ 
        { "name": "x", "type": ["null", "X"] },
        { "name": "m", "type": {"type": "map", "values": "Msg"} }
      ]
    }
  ]
}

Examples of Acceptable Aloha Feature Specifications

{ "name": "sum_key_lengths", "spec": "(0 /: ${x.m}.keys)(_ + _.length)" }
{ "name": "sum_values", "spec": "${x.m}.values.sum" }

Examples of Unacceptable Aloha Feature Specifications

{ "name": "sum_values", "spec": "${m.x}" }
{ "name": "sum_values", "spec": "${m[msg1]}" }
{ "name": "sum_values", "spec": "${m[msg1].x}" }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant