Closed jspeis closed 6 years ago
To provide more detail:
[500 Internal Server Error]:
Puma caught this error: undefined method `[]' for nil:NilClass (NoMethodError)
/home/deploy/.rvm/gems/jruby-9.1.13.0/gems/mondrian-rest-1.0.0-java/lib/mondrian_rest/api_formatters.rb:104:in `block in pluck'
I'm running into this one as well, it's somewhat of a show-stopper.
@jazzido can you point us in the right direction of a fix for this?
I'm taking a look at this
big thanks to @hwchen here were his findings:
What's happening is a combination of an implicit Mondrian cube server behavior, combined with lack of error handling in Mondrian Rest.
In the counties dim, there are counties in the same state which have the same short name, e.g. "Roanoke City" and "Roanoke County" become "Roanoke". Both have different ID (geoid). However, Mondrian doesn't like duplicate names, so it decides that there's only one dimension level member with name "Roanoke", so it simply takes the last last Roanoke it sees.
This translates into an error in Mondrian Rest because the ID key for the first "Roanoke" still exists, even though the associated dimension level member has been silently squashed.
When formatting the default json to something else, MRest uses a field called
cell_keys
, which holds all the ID keys. MRest then maps each ID key to a dimension level member, but because of Mondrian's behavior, that dim level member no longer exists for the duplicate name. Ruby happily assigns aNilClass
instead of the expected mapping. Then in the next step, metadata is plucked out of each dim level member, and when it comes time to do this with theNilClass
element, an exception occurs.
As a next step, @hwchen plans to help recognize this in the future by catching that exception at the pluck
and giving an error message explaining that the cause might be the above.
This API call runs into an error when trying to serialize to jsonrecords format, but works with default serialization format