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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]