/** * Checks whether the given index is an inverted index or not. */ public static boolean isInvertedIndex(Index index) { switch (index.getIndexType()) { case SINGLE_PARTITION_NGRAM_INVIX: case SINGLE_PARTITION_WORD_INVIX: case LENGTH_PARTITIONED_NGRAM_INVIX: case LENGTH_PARTITIONED_WORD_INVIX: return true; default: return false; } }
private static int[] secondaryFilterFields(Dataset dataset, Index index, ITypeTraits[] filterTypeTraits) throws CompilationException { if (filterTypeTraits == null) { return empty; } int numPrimaryKeys = dataset.getPrimaryKeys().size(); int numSecondaryKeys = index.getKeyFieldNames().size(); switch (index.getIndexType()) { case BTREE: return new int[] { numPrimaryKeys + numSecondaryKeys }; case RTREE: case LENGTH_PARTITIONED_NGRAM_INVIX: case LENGTH_PARTITIONED_WORD_INVIX: case SINGLE_PARTITION_NGRAM_INVIX: case SINGLE_PARTITION_WORD_INVIX: break; default: throw new CompilationException(ErrorCode.COMPILATION_UNKNOWN_INDEX_TYPE, index.getIndexType().toString()); } return empty; }
IAccessMethod chosenAccessMethod = amEntry.getKey(); Index chosenIndex = indexEntry.getKey(); IndexType indexType = chosenIndex.getIndexType(); boolean isKeywordOrNgramIndexChosen = indexType == IndexType.LENGTH_PARTITIONED_WORD_INVIX || indexType == IndexType.LENGTH_PARTITIONED_NGRAM_INVIX
public static IBinaryTokenizerFactory getBinaryTokenizerFactory(SearchModifierType searchModifierType, ATypeTag searchKeyType, Index index) throws AlgebricksException { switch (index.getIndexType()) { case SINGLE_PARTITION_WORD_INVIX: case LENGTH_PARTITIONED_WORD_INVIX: { return BinaryTokenizerFactoryProvider.INSTANCE.getWordTokenizerFactory(searchKeyType, false, false); } case SINGLE_PARTITION_NGRAM_INVIX: case LENGTH_PARTITIONED_NGRAM_INVIX: { // Make sure not to use pre- and postfixing for conjunctive searches. boolean prePost = (searchModifierType == SearchModifierType.CONJUNCTIVE || searchModifierType == SearchModifierType.CONJUNCTIVE_EDIT_DISTANCE) ? false : true; return BinaryTokenizerFactoryProvider.INSTANCE.getNGramTokenizerFactory(searchKeyType, index.getGramLength(), prePost, false); } default: { throw new CompilationException(ErrorCode.NO_TOKENIZER_FOR_TYPE, index.getIndexType()); } } }
private boolean isContainsFuncJoinOptimizable(Index index, IOptimizableFuncExpr optFuncExpr) { if (index.isEnforced()) { return isContainsFuncCompatible(index.getKeyFieldTypes().get(0).getTypeTag(), index.getIndexType()); } else { return isContainsFuncCompatible(optFuncExpr.getFieldType(0).getTypeTag(), index.getIndexType()); } }
private boolean isEditDistanceFuncJoinOptimizable(Index index, IOptimizableFuncExpr optFuncExpr) { if (index.isEnforced()) { return isEditDistanceFuncCompatible(index.getKeyFieldTypes().get(0).getTypeTag(), index.getIndexType()); } else { return isEditDistanceFuncCompatible(optFuncExpr.getFieldType(0).getTypeTag(), index.getIndexType()); } }
private boolean isFullTextContainsFuncJoinOptimizable(Index index, IOptimizableFuncExpr optFuncExpr) { if (index.isEnforced()) { return isFullTextContainsFuncCompatible(index.getKeyFieldTypes().get(0).getTypeTag(), index.getIndexType()); } else { return isFullTextContainsFuncCompatible(optFuncExpr.getFieldType(0).getTypeTag(), index.getIndexType()); } }
public static SecondaryIndexOperationsHelper createIndexOperationsHelper(Dataset dataset, Index index, MetadataProvider metadataProvider, SourceLocation sourceLoc) throws AlgebricksException { SecondaryIndexOperationsHelper indexOperationsHelper; switch (index.getIndexType()) { case BTREE: indexOperationsHelper = new SecondaryBTreeOperationsHelper(dataset, index, metadataProvider, sourceLoc); break; case RTREE: indexOperationsHelper = new SecondaryRTreeOperationsHelper(dataset, index, metadataProvider, sourceLoc); break; case SINGLE_PARTITION_WORD_INVIX: case SINGLE_PARTITION_NGRAM_INVIX: case LENGTH_PARTITIONED_WORD_INVIX: case LENGTH_PARTITIONED_NGRAM_INVIX: indexOperationsHelper = new SecondaryInvertedIndexOperationsHelper(dataset, index, metadataProvider, sourceLoc); break; default: throw new CompilationException(ErrorCode.COMPILATION_UNKNOWN_INDEX_TYPE, sourceLoc, index.getIndexType()); } indexOperationsHelper.init(); return indexOperationsHelper; }
public static SecondaryIndexOperationsHelper createIndexOperationsHelper(Dataset dataset, Index index, MetadataProvider metadataProvider, SourceLocation sourceLoc) throws AlgebricksException { SecondaryIndexOperationsHelper indexOperationsHelper; switch (index.getIndexType()) { case BTREE: indexOperationsHelper = new SecondaryCorrelatedBTreeOperationsHelper(dataset, index, metadataProvider, sourceLoc); break; case RTREE: indexOperationsHelper = new SecondaryCorrelatedRTreeOperationsHelper(dataset, index, metadataProvider, sourceLoc); break; case SINGLE_PARTITION_WORD_INVIX: case SINGLE_PARTITION_NGRAM_INVIX: case LENGTH_PARTITIONED_WORD_INVIX: case LENGTH_PARTITIONED_NGRAM_INVIX: indexOperationsHelper = new SecondaryCorrelatedInvertedIndexOperationsHelper(dataset, index, metadataProvider, sourceLoc); break; default: throw new CompilationException(ErrorCode.COMPILATION_UNKNOWN_INDEX_TYPE, sourceLoc, index.getIndexType()); } indexOperationsHelper.init(); return indexOperationsHelper; }
switch (index.getIndexType()) { case BTREE: dest.addAll(KeyFieldTypeUtil.getBTreeIndexKeyTypes(index, recordType, metaRecordType));
throws AlgebricksException { List<Integer> keySourceIndicators = index.getKeyFieldSourceIndicators(); switch (index.getIndexType()) { case BTREE: case SINGLE_PARTITION_WORD_INVIX: return NonTaggedFormatUtil.getNumDimensions(keyType.getTypeTag()) * 2; default: throw new CompilationException(ErrorCode.COMPILATION_UNKNOWN_INDEX_TYPE, index.getIndexType());
private boolean isFullTextContainsFuncSelectOptimizable(Index index, IOptimizableFuncExpr optFuncExpr) { AsterixConstantValue strConstVal = (AsterixConstantValue) ((ConstantExpression) optFuncExpr.getConstantExpr(0)).getValue(); IAObject strObj = strConstVal.getObject(); ATypeTag typeTag = strObj.getType().getTypeTag(); return isFullTextContainsFuncCompatible(typeTag, index.getIndexType()); }
int numPrimaryKeys = dataset.getPrimaryKeys().size(); int numSecondaryKeys = index.getKeyFieldNames().size(); IndexType indexType = index.getIndexType();
int numPrimaryKeys = dataset.getPrimaryKeys().size(); int numSecondaryKeys = index.getKeyFieldNames().size(); IndexType indexType = index.getIndexType();
dataset.getDatasetName(), indexName); switch (secondaryIndex.getIndexType()) { case SINGLE_PARTITION_WORD_INVIX: case SINGLE_PARTITION_NGRAM_INVIX: case LENGTH_PARTITIONED_NGRAM_INVIX: return getBinaryTokenizerRuntime(dataverseName, datasetName, indexName, inputSchema, propagatedSchema, primaryKeys, secondaryKeys, recordDesc, spec, secondaryIndex.getIndexType()); default: throw new AlgebricksException("Currently, we do not support TokenizeOperator for the index type: " + secondaryIndex.getIndexType());
int numPrimaryKeys = dataset.getPrimaryKeys().size(); int numSecondaryKeys = index.getKeyFieldNames().size(); IndexType indexType = index.getIndexType();
if (funcExpr != null) { return isJaccardFuncCompatible(funcExpr, optFuncExpr.getFieldType(i).getTypeTag(), index.getIndexType()); if (funcExpr != null) { return isJaccardFuncCompatible(funcExpr, optFuncExpr.getFieldType(i).getTypeTag(), index.getIndexType()); optFuncExpr.getFieldType(i).getTypeTag(), index.getIndexType());
private boolean isContainsFuncSelectOptimizable(Index index, IOptimizableFuncExpr optFuncExpr) { AsterixConstantValue strConstVal = (AsterixConstantValue) ((ConstantExpression) optFuncExpr.getConstantExpr(0)).getValue(); IAObject strObj = strConstVal.getObject(); ATypeTag typeTag = strObj.getType().getTypeTag(); if (!isContainsFuncCompatible(typeTag, index.getIndexType())) { return false; } // Check that the constant search string has at least gramLength characters. if (strObj.getType().getTypeTag() == ATypeTag.STRING) { AString astr = (AString) strObj; if (astr.getStringValue().length() >= index.getGramLength()) { return true; } } return false; }
ATypeTag typeTag = listOrStrObj.getType().getTypeTag(); if (!isEditDistanceFuncCompatible(typeTag, index.getIndexType())) { return false; if ((typeTag == ATypeTag.ARRAY) && (index.getIndexType() == IndexType.SINGLE_PARTITION_WORD_INVIX || index.getIndexType() == IndexType.LENGTH_PARTITIONED_WORD_INVIX)) { IACollection alist = (IACollection) listOrStrObj;
switch (index.getIndexType()) { case SINGLE_PARTITION_NGRAM_INVIX: case LENGTH_PARTITIONED_NGRAM_INVIX: { index.getIndexType());