nishantmonu51 commented on a change in pull request #5957: Renamed 'Generic
Column' -> 'Numeric Column'; Fixed a few resource leaks in processing; Fixed a
bug in SingleStringInputDimensionSelector; misc refinements
URL: https://github.com/apache/incubator-druid/pull/5957#discussion_r213653606
##########
File path:
processing/src/main/java/io/druid/segment/QueryableIndexColumnSelectorFactory.java
##########
@@ -79,28 +78,34 @@ private DimensionSelector
makeDimensionSelectorUndecorated(DimensionSpec dimensi
final String dimension = dimensionSpec.getDimension();
final ExtractionFn extractionFn = dimensionSpec.getExtractionFn();
- final Column columnDesc = index.getColumn(dimension);
- if (columnDesc == null) {
+ final ColumnHolder columnHolder = index.getColumnHolder(dimension);
+ if (columnHolder == null) {
return DimensionSelectorUtils.constantSelector(null, extractionFn);
}
- if (dimension.equals(Column.TIME_COLUMN_NAME)) {
- return new SingleScanTimeDimSelector(makeColumnValueSelector(dimension),
extractionFn, descending);
+ if (dimension.equals(ColumnHolder.TIME_COLUMN_NAME)) {
+ return new
SingleScanTimeDimensionSelector(makeColumnValueSelector(dimension),
extractionFn, descending);
}
- ValueType type = columnDesc.getCapabilities().getType();
+ ValueType type = columnHolder.getCapabilities().getType();
if (type.isNumeric()) {
return
type.makeNumericWrappingDimensionSelector(makeColumnValueSelector(dimension),
extractionFn);
}
- @SuppressWarnings("unchecked")
- DictionaryEncodedColumn<String> column = (DictionaryEncodedColumn<String>)
- columnCache.computeIfAbsent(dimension, d ->
closer.register(columnDesc.getDictionaryEncoding()));
+ BaseColumn column = columnCache.computeIfAbsent(dimension, d -> {
+ BaseColumn col = columnHolder.getColumn();
+ if (col instanceof DictionaryEncodedColumn) {
+ return closer.register(col);
+ } else {
+ return null;
Review comment:
should this return NilColumnValueSelector.instance() instead ?
If this is expected, need to make sure the method DimensionSpec.decorate
accept nulls and makeDimensionSelector is ok to return nulls.
----------------------------------------------------------------
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]