paul-rogers commented on a change in pull request #1429: DRILL-6676: Add Union, 
List and Repeated List types to Result Set Loader
URL: https://github.com/apache/drill/pull/1429#discussion_r211115512
 
 

 ##########
 File path: 
exec/vector/src/main/java/org/apache/drill/exec/vector/complex/BaseRepeatedValueVector.java
 ##########
 @@ -212,6 +212,18 @@ protected void replaceDataVector(ValueVector v) {
     vector = v;
   }
 
+  public void setChildVector(ValueVector childVector) {
+
+    // When created, the list uses the default vector of type LATE.
+    // That entry appears as a child vector. Remove it and add the
+    // new type instead.
+
+    assert vector == DEFAULT_DATA_VECTOR;
+    replaceDataVector(childVector);
 
 Review comment:
   This is a deep question. How much should each method check its invariants? 
And, should those checks be debug-only (e.g. asserts) or runtime (e.g. Guava 
preconditions)? Drill has never really developed a policy.
   
   Here we are simply asserting that the client is following the basic 
protocol: that the child vector can be set only once, to change the original 
LATE vector to something else.
   
   If the child vector is null, the next line below will cause an NPE.
   
   So, on this one, I think the above assertion does the job of enforcing the 
key constraint: the messy way that child vectors get set. What do you think?

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to