private void initInternalDataset(IAType itemType, IAType metaItemType, IDatasetDetails datasetDetails) throws AlgebricksException { InternalDatasetDetails internalDatasetDetails = (InternalDatasetDetails) datasetDetails; ARecordType recordType = (ARecordType) itemType; ARecordType metaRecordType = (ARecordType) metaItemType; List<IAType> partitioningKeyTypes = KeyFieldTypeUtil.getPartitioningKeyTypes(internalDatasetDetails, recordType, metaRecordType); int n = partitioningKeyTypes.size(); schemaTypes = metaItemType == null ? new IAType[n + 1] : new IAType[n + 2]; for (int keyIndex = 0; keyIndex < n; ++keyIndex) { schemaTypes[keyIndex] = partitioningKeyTypes.get(keyIndex); } schemaTypes[n] = itemType; if (metaItemType != null) { schemaTypes[n + 1] = metaItemType; } }
/** * Get the types of primary key (partitioning key) fields * * @param dataset, * the dataset to consider. * @param recordType, * the main record type. * @param metaRecordType * the auxiliary meta record type. * @return a list of IATypes, one for each corresponding primary key field. * @throws AlgebricksException */ public static List<IAType> getPartitoningKeyTypes(Dataset dataset, ARecordType recordType, ARecordType metaRecordType) throws AlgebricksException { if (dataset.getDatasetType() != DatasetType.INTERNAL) { return null; } InternalDatasetDetails datasetDetails = (InternalDatasetDetails) dataset.getDatasetDetails(); return getPartitioningKeyTypes(datasetDetails, recordType, metaRecordType); }