This is an automated email from the ASF dual-hosted git repository.
kishoreg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git
The following commit(s) were added to refs/heads/master by this push:
new cd86f60 Adding a null check inside getDataSource method for
potentially invalid column name (#5923)
cd86f60 is described below
commit cd86f60f92268f1408b79423bfe6c8eccda1ba07
Author: icefury71 <[email protected]>
AuthorDate: Wed Sep 9 11:51:46 2020 -0700
Adding a null check inside getDataSource method for potentially invalid
column name (#5923)
---
.../pinot/core/indexsegment/immutable/ImmutableSegmentImpl.java | 8 +++++++-
.../pinot/core/indexsegment/mutable/MutableSegmentImpl.java | 3 ++-
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git
a/pinot-core/src/main/java/org/apache/pinot/core/indexsegment/immutable/ImmutableSegmentImpl.java
b/pinot-core/src/main/java/org/apache/pinot/core/indexsegment/immutable/ImmutableSegmentImpl.java
index 42484cb..52537f5 100644
---
a/pinot-core/src/main/java/org/apache/pinot/core/indexsegment/immutable/ImmutableSegmentImpl.java
+++
b/pinot-core/src/main/java/org/apache/pinot/core/indexsegment/immutable/ImmutableSegmentImpl.java
@@ -23,9 +23,12 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.annotation.Nullable;
+
+import com.google.common.base.Preconditions;
import org.apache.pinot.core.common.DataSource;
import org.apache.pinot.core.segment.index.column.ColumnIndexContainer;
import org.apache.pinot.core.segment.index.datasource.ImmutableDataSource;
+import org.apache.pinot.core.segment.index.metadata.ColumnMetadata;
import org.apache.pinot.core.segment.index.metadata.SegmentMetadataImpl;
import org.apache.pinot.core.segment.index.readers.Dictionary;
import org.apache.pinot.core.segment.index.readers.ForwardIndexReader;
@@ -91,7 +94,10 @@ public class ImmutableSegmentImpl implements
ImmutableSegment {
@Override
public DataSource getDataSource(String column) {
- return new
ImmutableDataSource(_segmentMetadata.getColumnMetadataFor(column),
_indexContainerMap.get(column));
+ ColumnMetadata columnMetadata =
_segmentMetadata.getColumnMetadataFor(column);
+ Preconditions.checkNotNull(columnMetadata,
+ "ColumnMetadata for " + column + " should not be null. " +
"Potentially invalid column name specified.");
+ return new ImmutableDataSource(columnMetadata,
_indexContainerMap.get(column));
}
@Override
diff --git
a/pinot-core/src/main/java/org/apache/pinot/core/indexsegment/mutable/MutableSegmentImpl.java
b/pinot-core/src/main/java/org/apache/pinot/core/indexsegment/mutable/MutableSegmentImpl.java
index 5f04f0e..d6cfcc6 100644
---
a/pinot-core/src/main/java/org/apache/pinot/core/indexsegment/mutable/MutableSegmentImpl.java
+++
b/pinot-core/src/main/java/org/apache/pinot/core/indexsegment/mutable/MutableSegmentImpl.java
@@ -639,7 +639,8 @@ public class MutableSegmentImpl implements MutableSegment {
if (fieldSpec == null) {
// If the column was added during ingestion, we will construct the
column provider based on its fieldSpec to provide values
fieldSpec = _newlyAddedColumnsFieldMap.get(column);
- Preconditions.checkNotNull(fieldSpec, "FieldSpec for " + column + "
should not be null");
+ Preconditions.checkNotNull(fieldSpec,
+ "FieldSpec for " + column + " should not be null. " + "Potentially
invalid column name specified.");
}
// TODO: Refactor virtual column provider to directly generate data
source
VirtualColumnContext virtualColumnContext = new
VirtualColumnContext(fieldSpec, _numDocsIndexed);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]