Class DictionaryIndexType
- java.lang.Object
-
- org.apache.pinot.segment.spi.index.AbstractIndexType<DictionaryIndexConfig,Dictionary,SegmentDictionaryCreator>
-
- org.apache.pinot.segment.local.segment.index.dictionary.DictionaryIndexType
-
- All Implemented Interfaces:
ConfigurableFromIndexLoadingConfig<DictionaryIndexConfig>,IndexType<DictionaryIndexConfig,Dictionary,SegmentDictionaryCreator>
public class DictionaryIndexType extends AbstractIndexType<DictionaryIndexConfig,Dictionary,SegmentDictionaryCreator> implements ConfigurableFromIndexLoadingConfig<DictionaryIndexConfig>
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedDictionaryIndexType()
-
Method Summary
-
Methods inherited from class org.apache.pinot.segment.spi.index.AbstractIndexType
convertToNewFormat, equals, getConfig, getId, getReaderFactory, hashCode, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.pinot.segment.spi.index.IndexType
createMutableIndex, getIndexReader
-
-
-
-
Method Detail
-
getIndexConfigClass
public Class<DictionaryIndexConfig> getIndexConfigClass()
- Specified by:
getIndexConfigClassin interfaceIndexType<DictionaryIndexConfig,Dictionary,SegmentDictionaryCreator>
-
fromIndexLoadingConfig
public Map<String,DictionaryIndexConfig> fromIndexLoadingConfig(IndexLoadingConfig indexLoadingConfig)
Description copied from interface:ConfigurableFromIndexLoadingConfigReturns a map that can be used to get the index config. This map is used with higher priority whenever the index configuration needs to be read from anIndexLoadingConfig. SometimesIndexLoadingConfigis not completely configured andIndexLoadingConfig.getAllKnownColumns()does not return all columns in the table. Therefore the returned map may not have an entry for each column in the actual schema.- Specified by:
fromIndexLoadingConfigin interfaceConfigurableFromIndexLoadingConfig<DictionaryIndexConfig>- Returns:
- a map whose keys are the column names and the values are the index configuration for that column.
-
getDefaultConfig
public DictionaryIndexConfig getDefaultConfig()
- Specified by:
getDefaultConfigin interfaceIndexType<DictionaryIndexConfig,Dictionary,SegmentDictionaryCreator>
-
getPrettyName
public String getPrettyName()
- Specified by:
getPrettyNamein interfaceIndexType<DictionaryIndexConfig,Dictionary,SegmentDictionaryCreator>
-
createDeserializer
public ColumnConfigDeserializer<DictionaryIndexConfig> createDeserializer()
- Specified by:
createDeserializerin classAbstractIndexType<DictionaryIndexConfig,Dictionary,SegmentDictionaryCreator>
-
createIndexCreator
public SegmentDictionaryCreator createIndexCreator(IndexCreationContext context, DictionaryIndexConfig indexConfig)
- Specified by:
createIndexCreatorin interfaceIndexType<DictionaryIndexConfig,Dictionary,SegmentDictionaryCreator>
-
shouldUseVarLengthDictionary
public boolean shouldUseVarLengthDictionary(IndexCreationContext context, DictionaryIndexConfig indexConfig)
-
shouldUseVarLengthDictionary
public static boolean shouldUseVarLengthDictionary(String columnName, Set<String> varLengthDictColumns, FieldSpec.DataType columnStoredType, ColumnStatistics columnProfile)
-
shouldUseVarLengthDictionary
public static boolean shouldUseVarLengthDictionary(FieldSpec.DataType columnStoredType, ColumnStatistics profile)
-
ignoreDictionaryOverride
public static boolean ignoreDictionaryOverride(boolean optimizeDictionary, boolean optimizeDictionaryForMetrics, double noDictionarySizeRatioThreshold, FieldSpec fieldSpec, FieldIndexConfigs fieldIndexConfigs, int cardinality, int totalNumberOfEntries)This function evaluates whether to override dictionary (i.e use noDictionary) for a column even when its explicitly configured. This evaluation is for both dimension and metric column types.
-
createIndexCreator
public SegmentDictionaryCreator createIndexCreator(FieldSpec fieldSpec, File indexDir, boolean useVarLengthDictionary) throws Exception
- Throws:
Exception
-
read
public static Dictionary read(SegmentDirectory.Reader segmentReader, ColumnMetadata columnMetadata) throws IOException
- Throws:
IOException
-
read
public static Dictionary read(PinotDataBuffer dataBuffer, ColumnMetadata metadata, DictionaryIndexConfig indexConfig) throws IOException
- Throws:
IOException
-
createReaderFactory
protected IndexReaderFactory<Dictionary> createReaderFactory()
- Specified by:
createReaderFactoryin classAbstractIndexType<DictionaryIndexConfig,Dictionary,SegmentDictionaryCreator>
-
createIndexHandler
public IndexHandler createIndexHandler(SegmentDirectory segmentDirectory, Map<String,FieldIndexConfigs> configsByCol, @Nullable Schema schema, @Nullable TableConfig tableConfig)
- Specified by:
createIndexHandlerin interfaceIndexType<DictionaryIndexConfig,Dictionary,SegmentDictionaryCreator>
-
getFileExtension
public static String getFileExtension()
-
getFileExtension
public String getFileExtension(ColumnMetadata columnMetadata)
- Specified by:
getFileExtensionin interfaceIndexType<DictionaryIndexConfig,Dictionary,SegmentDictionaryCreator>
-
handleIndexSpecificCleanup
protected void handleIndexSpecificCleanup(TableConfig tableConfig)
- Overrides:
handleIndexSpecificCleanupin classAbstractIndexType<DictionaryIndexConfig,Dictionary,SegmentDictionaryCreator>
-
createMutableDictionary
@Nullable public static MutableDictionary createMutableDictionary(MutableIndexContext context, DictionaryIndexConfig config)
Creates a MutableDictionary. Unlikes most indexes, while dictionaries are important whenmutable segmentsare created, they do not follow theMutableIndexinterface and thereforeIndexType.createMutableIndex(MutableIndexContext, IndexConfig)is not implemented. This also means that dictionaries cannot be overridden in realtime tables.
-
-