Review Board 1.7.22


Patch for DRILL-229

Review Request #14958 - Created Oct. 25, 2013 and updated

Ben Becker
DRILL-229
Reviewers
drill-git
drill-git
Implements the merging receiver operator as described in DRILL-229.

Commit Log:

 - Fix multi-batch bugs.  Add human-readable test output.
 - Fix recordCount and valueIndex off-by-one
 - Implement manual comparison code generation.  Manual approach was chosen over modifying the ValueVectorReadExpression, EvalutionVisitor and CodeGenerator to minimize special-case code in those classes.
 - Implemented code gen for copying; comparison needs a materializer that works on a RecordBatchLoader
 - Flesh out the reset of the merging receiver and fix bugs.  Next step is generated code for comparator and copier.
 - Implements support for RecordBatchLoader, VectorContainer and BatchSchema in MergingRecordBatch Implements first-iteration specific logic WIP: Merge logic.  Some constructs are in place, others are temporary or only stubbed out)
 - Add SingleMergeExchange, which constructs one receiver and many senders (similar to UnionExchange)
 - Implement stub for MergingRecordBatch
 - Add test for MergingReceiver (leveraging SingleMergeExchange) s/MergingReceiver/MergingReceiverPOP/
 - Implement basic merging POP config and creator

 
exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/mergereceiver/MergingReceiverGeneratorBase.java
New File
[20] 29 lines
[+20]
30
  
30
  
31
  public abstract void doSetup(FragmentContext context,
31
  public abstract void doSetup(FragmentContext context,
32
                               RecordBatchLoader[] incomingBatchLoaders,
32
                               RecordBatchLoader[] incomingBatchLoaders,
33
                               RecordBatch outgoing) throws SchemaChangeException;
33
                               RecordBatch outgoing) throws SchemaChangeException;
34

    
   
34

   
35
  public abstract int doCompare(MergingRecordBatch.Node leftBatch,
35
  public abstract int doCompare(MergingRecordBatch.Node left,
36
                                MergingRecordBatch.Node leftIndex);
36
                                MergingRecordBatch.Node right);
37

    
   
37

   
38
  public abstract void doCopy(int inBatch, int inIndex, int outIndex);
38
  public abstract void doCopy(int inBatch, int inIndex, int outIndex);
39

    
   
39

   
40
  public abstract void doEval(int inBatch, int inIndex, int outIndex);

   
41

    
   

   
42
  public static TemplateClassDefinition<MergingReceiverGeneratorBase> TEMPLATE_DEFINITION =
40
  public static TemplateClassDefinition<MergingReceiverGeneratorBase> TEMPLATE_DEFINITION =
43
      new TemplateClassDefinition<>(MergingReceiverGeneratorBase.class, MergingReceiverTemplate.class);
41
      new TemplateClassDefinition<>(MergingReceiverGeneratorBase.class, MergingReceiverTemplate.class);
44

    
   
42

   
45
  public static final MappingSet COMPARE_MAPPING =
43
  public final MappingSet COMPARE_MAPPING =
46
    new MappingSet("left.valueIndex", "right.valueIndex",
44
    new MappingSet("left.valueIndex", "right.valueIndex",
47
      GM("doSetup", "doCompare", null, null),
45
      GM("doSetup", "doCompare", null, null),
48
      GM("doSetup", "doCompare", null, null));
46
      GM("doSetup", "doCompare", null, null));
49

    
   
47

   
50
  public static final MappingSet COPY_MAPPING =
48
  public final MappingSet COPY_MAPPING =
51
    new MappingSet("inIndex", "outIndex",
49
    new MappingSet("inIndex", "outIndex",
52
      GM("doSetup", "doCopy", null, null),
50
      GM("doSetup", "doCopy", null, null),
53
      GM("doSetup", "doCopy", null, null));
51
      GM("doSetup", "doCopy", null, null));
54

    
   
52

   
55
}
53
}
exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/mergereceiver/MergingReceiverTemplate.java
New File
 
exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/mergereceiver/MergingRecordBatch.java
New File
 
exec/java-exec/src/test/resources/mergerecv/merging_receiver.json
New File
 
  1. exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/mergereceiver/MergingReceiverGeneratorBase.java: Loading...
  2. exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/mergereceiver/MergingReceiverTemplate.java: Loading...
  3. exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/mergereceiver/MergingRecordBatch.java: Loading...
  4. exec/java-exec/src/test/resources/mergerecv/merging_receiver.json: Loading...