/** * Get the types of key fields for an index, either primary or secondary. * * @param recordType, * the main record type. * @param metaRecordType, * the auxiliary meta record type. * @param keys, * the list of key fields. * @param keySourceIndicators, * a list of integers to indicate that each key field is from the main record or the auxiliary meta * record. * @return a list of IATypes, one for each corresponding index key field. * @throws AlgebricksException */ public static List<IAType> getKeyTypes(ARecordType recordType, ARecordType metaRecordType, List<List<String>> keys, List<Integer> keySourceIndicators) throws AlgebricksException { List<IAType> keyTypes = new ArrayList<>(); int index = 0; for (List<String> partitioningKey : keys) { keyTypes.add(chooseSource(keySourceIndicators, index, recordType, metaRecordType) .getSubFieldType(partitioningKey)); ++index; } return keyTypes; }
/** * Get the types of BTree 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> getBTreeIndexKeyTypes(Index index, ARecordType recordType, ARecordType metaRecordType) throws AlgebricksException { List<Integer> keySourceIndicators = index.getKeyFieldSourceIndicators(); List<IAType> indexKeyTypes = new ArrayList<>(); for (int i = 0; i < index.getKeyFieldNames().size(); i++) { Pair<IAType, Boolean> keyPairType = Index.getNonNullableOpenFieldType(index.getKeyFieldTypes().get(i), index.getKeyFieldNames().get(i), chooseSource(keySourceIndicators, i, recordType, metaRecordType)); indexKeyTypes.add(keyPairType.first); } return indexKeyTypes; }
/** * 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; }
Pair<IAType, Boolean> keyPairType = Index.getNonNullableOpenFieldType(index.getKeyFieldTypes().get(0), index.getKeyFieldNames().get(0), chooseSource(keySourceIndicators, 0, recordType, metaRecordType)); IAType keyType = keyPairType.first; return NonTaggedFormatUtil.getNumDimensions(keyType.getTypeTag()) * 2;
RecordUtil.toFullyQualifiedName(partitioningExpr)); boolean nullable = KeyFieldTypeUtil.chooseSource(keySourceIndicators, i, recType, metaRecType) .isSubFieldNullable(partitioningExpr); if (nullable) {
IAType fieldType = null; ARecordType subType = KeyFieldTypeUtil.chooseSource(keySourceIndicators, keyIndex, aRecordType, metaRecordType); boolean isOpen = subType.isOpen(); int i = 0;