use of com.apple.foundationdb.record.AggregateFunctionNotSupportedException in project fdb-record-layer by FoundationDB.
the class IndexBuildState method loadIndexBuildStateAsync.
/**
* Load the build progress ({@link IndexBuildState}) of the given index in the given record store asynchronously.
* @param store the record store containing the index
* @param index the index needed to be checked
* @return a future that completes to the index build state
*/
@Nonnull
public static CompletableFuture<IndexBuildState> loadIndexBuildStateAsync(FDBRecordStoreBase<?> store, Index index) {
IndexState indexState = store.getUntypedRecordStore().getIndexState(index);
if (indexState != IndexState.WRITE_ONLY) {
return CompletableFuture.completedFuture(new IndexBuildState(indexState));
}
CompletableFuture<Long> recordsInTotalFuture;
try {
recordsInTotalFuture = store.getSnapshotRecordCount();
} catch (AggregateFunctionNotSupportedException ex) {
// getSnapshotRecordCount failed, very likely it is because there is no suitable COUNT type index
// defined.
recordsInTotalFuture = CompletableFuture.completedFuture(null);
}
return loadRecordsScannedAsync(store, index).thenCombine(recordsInTotalFuture, (scannedRecords, recordsInTotal) -> new IndexBuildState(indexState, scannedRecords, recordsInTotal));
}
use of com.apple.foundationdb.record.AggregateFunctionNotSupportedException in project fdb-record-layer by FoundationDB.
the class FDBRestrictedIndexQueryTest method assertThrowsAggregateFunctionNotSupported.
public static void assertThrowsAggregateFunctionNotSupported(Executable executable, String aggregateFunction) {
final AggregateFunctionNotSupportedException e = assertThrows(AggregateFunctionNotSupportedException.class, executable);
assertEquals("Aggregate function requires appropriate index", e.getMessage());
assertEquals(aggregateFunction, e.getLogInfo().get(LogMessageKeys.FUNCTION.toString()).toString());
}
Aggregations