public static ColumnSelectorFactory makeColumnSelectorFactory ( final VirtualColumns virtualColumns , final AggregatorFactory agg , final Supplier < InputRow > in , final boolean deserializeComplexMetrics ) { final RowBasedColumnSelectorFactory baseSelectorFactory = RowBasedColumnSelectorFactory . create ( in , null ) ; class IncrementalIndexInputRowColumnSelectorFactory implements ColumnSelectorFactory { @ Override public ColumnValueSelector < ? > makeColumnValueSelector ( final String column ) { final String typeName = agg . getTypeName ( ) ; boolean isComplexMetric = GuavaUtils . getEnumIfPresent ( ValueType . class , StringUtils . toUpperCase ( typeName ) ) == null || typeName . equalsIgnoreCase ( ValueType . COMPLEX . name ( ) ) ; if ( ! isComplexMetric || ! deserializeComplexMetrics ) { return baseSelectorFactory . makeColumnValueSelector ( column ) ; } else { final ComplexMetricSerde serde = ComplexMetrics . getSerdeForType ( typeName ) ; if ( serde == null ) { throw new ISE ( "Don't know how to handle type[%s]" , typeName ) ; } final ComplexMetricExtractor extractor = serde . getExtractor ( ) ; return new ColumnValueSelector ( ) { @ Override public boolean isNull ( ) { return in . get ( ) . getMetric ( column ) == null ; } @ Override public long getLong ( ) { Number metric = in . get ( ) . getMetric ( column ) ; assert NullHandling . replaceWithDefault ( ) || metric != null ; return DimensionHandlerUtils . nullToZero ( metric ) . longValue ( ) ; } @ Override public float getFloat ( ) { Number metric = in . get ( ) . getMetric ( column ) ; assert NullHandling . replaceWithDefault ( ) || metric != null ; return DimensionHandlerUtils . nullToZero ( metric ) . floatValue ( ) ; } @ Override public double getDouble ( ) { Number metric = in . get ( ) . getMetric ( column ) ; assert NullHandling . replaceWithDefault ( ) || metric != null ; return DimensionHandlerUtils . nullToZero ( metric ) . doubleValue ( ) ; } @ Override public Class classOfObject ( ) { return extractor . extractedClass ( ) ; } @ Nullable @ Override public Object getObject ( ) { return extractor . extractValue ( in . get ( ) , column , agg ) ; } @ Override public void inspectRuntimeShape ( RuntimeShapeInspector inspector ) { inspector . visit ( "in" , in ) ; inspector . visit ( "extractor" , extractor ) ; } } ; } } @ Override public DimensionSelector makeDimensionSelector ( DimensionSpec dimensionSpec ) { return baseSelectorFactory . makeDimensionSelector ( dimensionSpec ) ; } @ Nullable @ Override public ColumnCapabilities getColumnCapabilities ( String columnName ) { return baseSelectorFactory . getColumnCapabilities ( columnName ) ; } } return virtualColumns . wrap ( new IncrementalIndexInputRowColumnSelectorFactory ( ) ) ; }
Column selector used at ingestion time for inputs to aggregators .