Tajo
  1. Tajo
  2. TAJO-92

LogicalNode misses some fields when it converts to json

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: 0.2-incubating
    • Component/s: planner/optimizer
    • Labels:
      None

      Description

      See title. The below code reproduces the error

          PlanningContext context = analyzer.parse(
                  "select table0.age, count(*) as count_age from table0 group by table0.age");
      
          LogicalNode plan = logicalPlanner.createPlan(context);
          plan = LogicalOptimizer.optimize(context, plan);
      
          String planJSON = plan.toJSON();
      
          LogicalNode planFromJSON = GsonCreator.getInstance().fromJson(planJSON, LogicalNode.class);
      
          MasterPlan globalPlan = planner.build(queryId, (LogicalRootNode) planFromJSON);
      
      com.google.protobuf.UninitializedMessageException: Message missing required fields: type
      	at com.google.protobuf.AbstractMessage$Builder.newUninitializedMessageException(AbstractMessage.java:605)
      	at org.apache.tajo.catalog.proto.CatalogProtos$FunctionDescProto$Builder.build(CatalogProtos.java:6999)
      	at org.apache.tajo.catalog.FunctionDesc.mergeLocalToProto(FunctionDesc.java:231)
      	at org.apache.tajo.catalog.FunctionDesc.getProto(FunctionDesc.java:193)
      	at org.apache.tajo.catalog.FunctionDesc.equals(FunctionDesc.java:168)
      	at org.apache.tajo.util.TUtil.checkEquals(TUtil.java:44)
      	at org.apache.tajo.engine.eval.FuncEval.equals(FuncEval.java:93)
      	at org.apache.tajo.engine.planner.PlannerUtil.transformGroupbyTo2P(PlannerUtil.java:196)
      	at org.apache.tajo.engine.planner.PlannerUtil.transformGroupbyTo2PWithStore(PlannerUtil.java:242)
      	at org.apache.tajo.master.GlobalPlanner$GlobalPlanBuilder.visit(GlobalPlanner.java:136)
      	at org.apache.tajo.engine.planner.logical.UnaryNode.postOrder(UnaryNode.java:66)
      	at org.apache.tajo.engine.planner.logical.UnaryNode.postOrder(UnaryNode.java:65)
      	at org.apache.tajo.engine.planner.logical.UnaryNode.postOrder(UnaryNode.java:65)
      	at org.apache.tajo.master.GlobalPlanner.convertTo2Phase(GlobalPlanner.java:279)
      	at org.apache.tajo.master.GlobalPlanner.build(GlobalPlanner.java:99)
      

        Issue Links

          Activity

          Hide
          Hyoungjun Kim added a comment -

          TestCase

          Show
          Hyoungjun Kim added a comment - TestCase
          Hide
          Hyunsik Choi added a comment -

          This is definitely a bug. This is caused lazy copy approach. I'm going to find out the solution. Thank you for reporting.

          Show
          Hyunsik Choi added a comment - This is definitely a bug. This is caused lazy copy approach. I'm going to find out the solution. Thank you for reporting.
          Hide
          Henry Saputra added a comment - - edited

          Can I take a look at this one? Would this be another good candidate for newbie?

          Show
          Henry Saputra added a comment - - edited Can I take a look at this one? Would this be another good candidate for newbie?
          Hide
          Hyunsik Choi added a comment -

          I think the simplest solution is to remove the lazy copy approach. For this, I created the issue TAJO-95. Would you be willing to take this issue?

          Show
          Hyunsik Choi added a comment - I think the simplest solution is to remove the lazy copy approach. For this, I created the issue TAJO-95 . Would you be willing to take this issue?
          Hide
          Henry Saputra added a comment -

          How does TAJO-95 relate to TAJO-92? By removing JSON serde support?

          Show
          Henry Saputra added a comment - How does TAJO-95 relate to TAJO-92 ? By removing JSON serde support?
          Hide
          Hyunsik Choi added a comment -

          Henry,

          We use GSON as JSON (de)serialization frameowork. In order to serialize an object to a JSON document, all attributes should be stored in member variables of an object. But, some objects are designed to be (de)serialized to both JSON and Protocol buffer type objects. For protocol buffer, we use the lazy copy approach (see TAJO-95). Actually, this approach looks efficiency, but error prone. This bug (TAJO-92) is an example case of that.

          Show
          Hyunsik Choi added a comment - Henry, We use GSON as JSON (de)serialization frameowork. In order to serialize an object to a JSON document, all attributes should be stored in member variables of an object. But, some objects are designed to be (de)serialized to both JSON and Protocol buffer type objects. For protocol buffer, we use the lazy copy approach (see TAJO-95 ). Actually, this approach looks efficiency, but error prone. This bug ( TAJO-92 ) is an example case of that.
          Hide
          Henry Saputra added a comment -

          Thanks Hyunsik, I will assign TAJO-95 to myself.

          Show
          Henry Saputra added a comment - Thanks Hyunsik, I will assign TAJO-95 to myself.
          Hide
          Hyunsik Choi added a comment -

          This was resolved by TAJO-95.

          Show
          Hyunsik Choi added a comment - This was resolved by TAJO-95 .

            People

            • Assignee:
              Unassigned
              Reporter:
              Hyoungjun Kim
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development