You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by GitBox <gi...@apache.org> on 2018/07/09 20:35:54 UTC

[GitHub] Ben-Zvi commented on a change in pull request #1367: DRILL-6585: PartitionSender clones vectors, but shares field metdata

Ben-Zvi commented on a change in pull request #1367: DRILL-6585: PartitionSender clones vectors, but shares field metdata
URL: https://github.com/apache/drill/pull/1367#discussion_r201137510
 
 

 ##########
 File path: exec/vector/src/main/codegen/templates/BasicTypeHelper.java
 ##########
 @@ -233,10 +227,54 @@ public static ValueVector getNewVector(String name, BufferAllocator allocator, M
       throw new UnsupportedOperationException(buildErrorMessage("get holder reader implementation", type, mode));
   }
   
-  public static ValueVector getNewVector(MaterializedField field, BufferAllocator allocator){
+  public static ValueVector getNewVector(String name, BufferAllocator allocator, MajorType type, CallBack callBack) {
+    MaterializedField field = MaterializedField.create(name, type);
+    return getNewVector(field, allocator, callBack);
+  }  
+  
+  public static ValueVector getNewVector(MaterializedField field, BufferAllocator allocator) {
     return getNewVector(field, allocator, null);
   }
-  public static ValueVector getNewVector(MaterializedField field, BufferAllocator allocator, CallBack callBack){
+  
+  /**
+   * Create a new vector by cloning the metadata from an existing vector. Use this
+   * variation when the metadata is already in use and so should <i>not</i> be
+   * attached to the new vector.
+   * 
+   * @param field field metadata to be cloned for the new vector
+   * @param allocator allocator to use to allocate memory for the vector
+   * @param callBack callBack when the schema of the vector changes (not typically
+   * used in modern Drill)
+   * @return the new vector with no memory allocated
+   * @see #getNewVector(MaterializedField, BufferAllocator, CallBack) for when
+   * the metadata need not be cloned
+   */
+  
+  public static ValueVector getClonedVector(MaterializedField field, BufferAllocator allocator, CallBack callBack) {
+    MaterializedField newField = MaterializedField.create(field.getName(), field.getType());
 
 Review comment:
   Isn't `field.getType()` just returning the type as is ?  So where does the cloning happen ?

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


With regards,
Apache Git Services