haibow commented on a change in pull request #4774: Refactor virtualColumn
URL: https://github.com/apache/incubator-pinot/pull/4774#discussion_r344419210
 
 

 ##########
 File path: 
pinot-core/src/main/java/org/apache/pinot/core/indexsegment/mutable/MutableSegmentImpl.java
 ##########
 @@ -472,10 +476,8 @@ public SegmentMetadata getSegmentMetadata() {
   public ColumnDataSource getDataSource(String columnName) {
     FieldSpec fieldSpec = _schema.getFieldSpecFor(columnName);
     if (fieldSpec.isVirtualColumn()) {
-      VirtualColumnContext virtualColumnContext =
-          new VirtualColumnContext(NetUtil.getHostnameOrAddress(), 
getSegmentName(), columnName, _numDocsIndexed + 1);
-      VirtualColumnProvider virtualColumnProvider =
-          
VirtualColumnProviderFactory.buildProvider(_schema.getFieldSpecFor(columnName).getVirtualColumnProvider());
+      VirtualColumnContext virtualColumnContext = new 
VirtualColumnContext(fieldSpec, _numDocsIndexed);
 
 Review comment:
   Previously virtual columns were not added to the mutable segments. I added 
them in this diff.
   
   In `MutableSegmentImplTest` there is a test validating the total number of 
documents for each column (physical and virtual) in the mutable segments and 
immutable segment that both read from the same avro file. It was only checking 
physical columns before. After I add the virtual columns to the mutable 
segment, the test failed due to one extra row in the mutable segment, likely 
caused by this ` + 1`

----------------------------------------------------------------
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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to