public FileSplit[] splitsForIndex(MetadataTransactionContext mdTxnCtx, Dataset dataset, String indexName) throws AlgebricksException { return SplitsAndConstraintsUtil.getIndexSplits(dataset, indexName, mdTxnCtx, appCtx.getClusterStateManager()); }
public static FileSplit[] getIndexSplits(Dataset dataset, String indexName, MetadataTransactionContext mdTxnCtx, IClusterStateManager csm) throws AlgebricksException { try { NodeGroup nodeGroup = MetadataManager.INSTANCE.getNodegroup(mdTxnCtx, dataset.getNodeGroupName()); if (nodeGroup == null) { throw new AlgebricksException("Couldn't find node group " + dataset.getNodeGroupName()); } List<String> nodeList = nodeGroup.getNodeNames(); return getIndexSplits(csm, dataset, indexName, nodeList); } catch (MetadataException me) { throw new AlgebricksException(me); } }
public SecondaryIndexInfo(PrimaryIndexInfo primaryIndexInfo, Index secondaryIndex) { this.primaryIndexInfo = primaryIndexInfo; this.secondaryIndex = secondaryIndex; List<String> nodes = Collections.singletonList(ExecutionTestUtil.integrationUtil.ncs[0].getId()); CcApplicationContext appCtx = (CcApplicationContext) ExecutionTestUtil.integrationUtil.cc.getApplicationContext(); FileSplit[] splits = SplitsAndConstraintsUtil.getIndexSplits(appCtx.getClusterStateManager(), primaryIndexInfo.dataset, secondaryIndex.getIndexName(), nodes); fileSplitProvider = new ConstantFileSplitProvider(splits); secondaryIndexTypeTraits = createSecondaryIndexTypeTraits(primaryIndexInfo.recordType, primaryIndexInfo.metaType, primaryIndexInfo.primaryKeyTypes, secondaryIndex.getKeyFieldTypes().toArray(new IAType[secondaryIndex.getKeyFieldTypes().size()])); secondaryIndexSerdes = createSecondaryIndexSerdes(primaryIndexInfo.recordType, primaryIndexInfo.metaType, primaryIndexInfo.primaryKeyTypes, secondaryIndex.getKeyFieldTypes().toArray(new IAType[secondaryIndex.getKeyFieldTypes().size()])); rDesc = new RecordDescriptor(secondaryIndexSerdes, secondaryIndexTypeTraits); insertFieldsPermutations = new int[secondaryIndexTypeTraits.length]; for (int i = 0; i < insertFieldsPermutations.length; i++) { insertFieldsPermutations[i] = i; } primaryKeyIndexes = new int[primaryIndexInfo.primaryKeyIndexes.length]; for (int i = 0; i < primaryKeyIndexes.length; i++) { primaryKeyIndexes[i] = i + secondaryIndex.getKeyFieldNames().size(); } }
CcApplicationContext appCtx = (CcApplicationContext) ExecutionTestUtil.integrationUtil.cc.getApplicationContext(); FileSplit[] splits = SplitsAndConstraintsUtil.getIndexSplits(appCtx.getClusterStateManager(), dataset, index.getIndexName(), nodes); fileSplitProvider = new ConstantFileSplitProvider(splits);
/** * Gets the file splits of {@code dataset} * * @param integrationUtil * @param dataset * @return the file splits of the dataset * @throws RemoteException * @throws AlgebricksException */ public static FileSplit[] getDatasetSplits(AsterixHyracksIntegrationUtil integrationUtil, Dataset dataset) throws RemoteException, AlgebricksException { final ICcApplicationContext ccAppCtx = (ICcApplicationContext) integrationUtil.getClusterControllerService().getApplicationContext(); final MetadataTransactionContext mdTxnCtx = MetadataManager.INSTANCE.beginTransaction(); try { return SplitsAndConstraintsUtil.getIndexSplits(dataset, dataset.getDatasetName(), mdTxnCtx, ccAppCtx.getClusterStateManager()); } finally { MetadataManager.INSTANCE.commitTransaction(mdTxnCtx); } }
final Dataset dataset = MetadataManager.INSTANCE.getDataset(mdTxn, defaultDv, datasetName); MetadataManager.INSTANCE.commitTransaction(mdTxn); FileSplit[] splits = SplitsAndConstraintsUtil.getIndexSplits(appCtx.getClusterStateManager(), dataset, indexName, Arrays.asList("asterix_nc1")); final ConstantFileSplitProvider constantFileSplitProvider =