/** * Get the types of RTree index key fields * * @param index, * the index to consider. * @param recordType, * the main record type. * @param metaRecordType * the auxiliary meta record type. * @return a list of IATypes, one for each corresponding index key field. * @throws AlgebricksException */ public static List<IAType> getRTreeIndexKeyTypes(Index index, ARecordType recordType, ARecordType metaRecordType) throws AlgebricksException { List<Integer> keySourceIndicators = index.getKeyFieldSourceIndicators(); List<IAType> indexKeyTypes = new ArrayList<>(); ARecordType targetRecType = chooseSource(keySourceIndicators, 0, recordType, metaRecordType); Pair<IAType, Boolean> keyPairType = Index.getNonNullableOpenFieldType(index.getKeyFieldTypes().get(0), index.getKeyFieldNames().get(0), targetRecType); IAType keyType = keyPairType.first; IAType nestedKeyType = NonTaggedFormatUtil.getNestedSpatialType(keyType.getTypeTag()); int numKeys = KeyFieldTypeUtil.getNumSecondaryKeys(index, targetRecType, metaRecordType); for (int i = 0; i < numKeys; i++) { indexKeyTypes.add(nestedKeyType); } return indexKeyTypes; }
throw new AsterixException("Could not find field " + secondaryKeyFields.get(0) + " in the schema."); IAType nestedKeyType = NonTaggedFormatUtil.getNestedSpatialType(spatialType.getTypeTag()); int numDimensions = NonTaggedFormatUtil.getNumDimensions(spatialType.getTypeTag()); int numNestedSecondaryKeyFields = numDimensions * 2;
int numNestedSecondaryKeyFields = numDimensions * 2; ITypeTraits[] secondaryTypeTraits = new ITypeTraits[numNestedSecondaryKeyFields + numPrimaryKeys]; IAType nestedKeyType = NonTaggedFormatUtil.getNestedSpatialType(spatialType.getTypeTag()); for (int i = 0; i < numNestedSecondaryKeyFields; i++) { secondaryTypeTraits[i] = ttProvider.getTypeTrait(nestedKeyType);
secondaryTypeTraits = new ITypeTraits[numNestedSecondaryKeyFields + numPrimaryKeys]; ITypeTraits[] enforcedTypeTraits = new ITypeTraits[1 + numPrimaryKeys]; IAType nestedKeyType = NonTaggedFormatUtil.getNestedSpatialType(spatialType.getTypeTag()); keyType = nestedKeyType.getTypeTag(); for (int i = 0; i < numNestedSecondaryKeyFields; i++) {
secondaryTypeTraits = new ITypeTraits[numNestedSecondaryKeyFields + numPrimaryKeys]; ITypeTraits[] enforcedTypeTraits = new ITypeTraits[1 + numPrimaryKeys]; IAType nestedKeyType = NonTaggedFormatUtil.getNestedSpatialType(spatialType.getTypeTag()); keyType = nestedKeyType.getTypeTag(); for (int i = 0; i < numNestedSecondaryKeyFields; i++) {
new IPrimitiveValueProviderFactory[numNestedSecondaryKeyFields]; ITypeTraits[] secondaryTypeTraits = new ITypeTraits[numNestedSecondaryKeyFields + numPrimaryKeys]; IAType nestedKeyType = NonTaggedFormatUtil.getNestedSpatialType(spatialType.getTypeTag()); ATypeTag keyType = nestedKeyType.getTypeTag(); for (int i = 0; i < numNestedSecondaryKeyFields; i++) {