ihuzenko commented on a change in pull request #1829: DRILL-7096: Develop 
vector for canonical Map<K,V>
URL: https://github.com/apache/drill/pull/1829#discussion_r319923569
 
 

 ##########
 File path: 
exec/java-exec/src/main/java/org/apache/drill/exec/record/TypedFieldId.java
 ##########
 @@ -38,47 +36,51 @@
  */
 
 public class TypedFieldId {
-  final MajorType finalType;
-  final MajorType secondaryFinal;
-  final MajorType intermediateType;
-  final int[] fieldIds;
-  final boolean isHyperReader;
-  final boolean isListVector;
-  final PathSegment remainder;
-  private final Map<Integer, MajorType> types;
-
-  public TypedFieldId(MajorType type, int... fieldIds) {
-    this(type, type, type, false, null, fieldIds);
-  }
 
-  public TypedFieldId(MajorType type, IntArrayList breadCrumb, PathSegment 
remainder) {
-    this(type, type, type, false, remainder, breadCrumb.toArray());
-  }
+  private final MajorType finalType;
+  private final MajorType secondaryFinal;
+  private final MajorType intermediateType;
+  private final int[] fieldIds;
+  private final boolean isHyperReader;
+  private final boolean isListVector;
+  private final PathSegment remainder;
 
-  public TypedFieldId(MajorType type, boolean isHyper, int... fieldIds) {
-    this(type, type, type, isHyper, null, fieldIds);
-  }
-
-  public TypedFieldId(MajorType intermediateType, MajorType secondaryFinal, 
MajorType finalType, boolean isHyper, PathSegment remainder, int... fieldIds) {
-    this(intermediateType, secondaryFinal, finalType, isHyper, false, 
remainder, new HashMap<>(), fieldIds);
-  }
-
-  public TypedFieldId(MajorType intermediateType, MajorType secondaryFinal, 
MajorType finalType, boolean isHyper, boolean isListVector,
-                      PathSegment remainder, Map<Integer, MajorType> types, 
int... fieldIds) {
-    super();
-    this.intermediateType = intermediateType;
-    this.finalType = finalType;
-    this.secondaryFinal = secondaryFinal;
-    this.fieldIds = fieldIds;
-    this.isHyperReader = isHyper;
-    this.isListVector = isListVector;
-    this.remainder = remainder;
-    this.types = types;
+  /**
+   * Used to determine if a dict is placed at specific depth
+   */
+  private final BitSet dictBitSet;
+
+  private TypedFieldId(Builder builder) {
+    this.intermediateType = builder.intermediateType;
+    this.finalType = builder.finalType;
+    this.secondaryFinal = builder.secondaryFinal;
+    this.fieldIds = builder.ids.toArray();
+    this.isHyperReader = builder.hyperReader;
+    this.isListVector = builder.isListVector;
+    this.remainder = builder.remainder;
+    this.dictBitSet = builder.dictBitSet;
   }
 
   public TypedFieldId cloneWithChild(int id) {
     int[] fieldIds = ArrayUtils.add(this.fieldIds, id);
-    return new TypedFieldId(intermediateType, secondaryFinal, finalType, 
isHyperReader, remainder, fieldIds);
+    return getBuilder().clearAndAddIds(fieldIds)
+        .build();
+  }
+
+  private Builder getBuilder() {
+    Builder builder = new Builder().intermediateType(intermediateType)
+        .finalType(finalType)
+        .secondaryFinal(secondaryFinal)
+        .addIds(fieldIds)
+        .remainder(remainder)
+        .copyDictBitSet(dictBitSet);
+    if (isHyperReader) {
+      builder.hyper();
+    }
+    if (isListVector) {
+      builder.listVector();
 
 Review comment:
   The listVector() could simply accept boolean.
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to