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

Hadrian fails when numbers are used as Map keys. #42

Open
jthompson6 opened this issue Jul 19, 2017 · 1 comment
Open

Hadrian fails when numbers are used as Map keys. #42

jthompson6 opened this issue Jul 19, 2017 · 1 comment

Comments

@jthompson6
Copy link

jthompson6 commented Jul 19, 2017

For instance, the YAML

output: 
  type: map
  values: double
method: map
action:
  - {"new": {"0": input}, "type":{"values":"double","type": "map"}}

fails with the message "0" is not a valid symbol name. The same YAML with "a" as the map key works.

In Titus, both
PFAEngine.fromJson('''{"input":"double","output":{"values":"double","type":"map"},"method":"map","action":{"new":{"0":"input"}, "type":{"values":"double","type":"map"}}}''')
and
PFAEngine.fromJson('''{"input":"double","output":{"values":"double","type":"map"},"method":"map","action":{"new":{"a":"input"}, "type":{"values":"double","type":"map"}}}''')
work.

@jpivarski
Copy link
Contributor

https://github.com/opendatagroup/hadrian/blob/master/hadrian/src/main/scala/com/opendatagroup/hadrian/reader.scala#L989

This readExpressionMap should have keysMustBeSymbols = false. See the definition here:

https://github.com/opendatagroup/hadrian/blob/master/hadrian/src/main/scala/com/opendatagroup/hadrian/reader.scala#L667

Not checking for valid symbols would be okay because if they're not actual field names, it will fail later in compilation.

Titus is missing this feature altogether:

https://github.com/opendatagroup/hadrian/blob/master/titus/titus/reader.py#L507

I don't know if that's a different problem.

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

2 participants