You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pinot.apache.org by GitBox <gi...@apache.org> on 2019/01/18 22:51:41 UTC

[GitHub] Jackie-Jiang commented on a change in pull request #3711: Fix SegmentConverter to handle virtual column

Jackie-Jiang commented on a change in pull request #3711: Fix SegmentConverter to handle virtual column
URL: https://github.com/apache/incubator-pinot/pull/3711#discussion_r249208864
 
 

 ##########
 File path: pinot-core/src/main/java/org/apache/pinot/core/data/readers/PinotSegmentRecordReader.java
 ##########
 @@ -72,7 +73,10 @@ public PinotSegmentRecordReader(@Nonnull File indexDir, @Nullable Schema schema,
       SegmentMetadata segmentMetadata = _immutableSegment.getSegmentMetadata();
       _numDocs = segmentMetadata.getTotalRawDocs();
       if (schema == null) {
-        _schema = segmentMetadata.getSchema();
+        // In order not to expose virtual columns to client, schema shouldn't be fetched from segmentMetadata;
+        // otherwise the original metadata will be modified.
+        _schema = new SegmentMetadataImpl(indexDir).getSchema();
+        _schema.getAllFieldSpecs().removeIf(fieldSpec -> _schema.isVirtualColumn(fieldSpec.getName()));
 
 Review comment:
   You don't need to remove virtual columns here because virtual columns will not be added to the segment metadata without explicitly adding them.

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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pinot.apache.org
For additional commands, e-mail: dev-help@pinot.apache.org