Uploaded image for project: 'Apache Drill'
  1. Apache Drill
  2. DRILL-8431

add immutable wrapper for ObjectMapper



    • Task
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • Server
    • None


      The Jackson based code in Drill is quite complicated and passes around ObjectMapper instances in a way that is difficult to maintain.

      We need to balance the objective of trying to reuse ObjectMapper instances (because they are fairly expensive to create) but avoid the risk that code modifies an ObjectMapper instance (extra config or extra modules added) in a way that affects other code that uses the ObjectMapper instance.

      Jackson 3 (which is under development but a long way off) moves towards making ObjectMappers immutable. Mapper Builders are used instead to configure mappers. Some of these API changes are already backported to Jackson 2.

      My suggestion in this Jira is that we create a new Drill class called ImmutableObjectMapper and this exposes API methods for reading and writing JSON but that hides methods for configuring the mapper. We can wrap some of our ObjectMappers. It will probably take a few iterations to get everything switched over but we can start with the low hanging fruit.

      This class would allow the Java compiler to check for any untidy attempts to modify an ObjectMapper that was created elsewhere. 


        Issue Links



              Unassigned Unassigned
              pj.fanning PJ Fanning
              0 Vote for this issue
              2 Start watching this issue