use of javax.annotation.Nullable in project pinot by linkedin.
the class SegmentDirectoryPaths method findFormatFile.
@Nullable
private static File findFormatFile(@Nonnull File indexDir, String fileName) {
Preconditions.checkNotNull(indexDir);
Preconditions.checkArgument(indexDir.exists(), "Path %s does not exist", indexDir);
if (!indexDir.isDirectory()) {
return indexDir;
}
File v1File = new File(indexDir, fileName);
if (v1File.exists()) {
return v1File;
}
File v3Dir = segmentDirectoryFor(indexDir, SegmentVersion.v3);
File v3File = new File(v3Dir, fileName);
if (v3File.exists()) {
return v3File;
}
return null;
}
use of javax.annotation.Nullable in project presto by prestodb.
the class QueryStateMachine method transitionToFinishing.
public boolean transitionToFinishing() {
Duration durationSinceCreation = nanosSince(createNanos).convertToMostSuccinctTimeUnit();
queuedTime.compareAndSet(null, durationSinceCreation);
totalPlanningStartNanos.compareAndSet(null, tickerNanos());
totalPlanningTime.compareAndSet(null, nanosSince(totalPlanningStartNanos.get()));
DateTime now = DateTime.now();
executionStartTime.compareAndSet(null, now);
finishingStartNanos.compareAndSet(null, tickerNanos());
if (!queryState.setIf(FINISHING, currentState -> currentState != FINISHING && !currentState.isDone())) {
return false;
}
if (autoCommit) {
ListenableFuture<?> commitFuture = transactionManager.asyncCommit(session.getTransactionId().get());
Futures.addCallback(commitFuture, new FutureCallback<Object>() {
@Override
public void onSuccess(@Nullable Object result) {
transitionToFinished();
}
@Override
public void onFailure(Throwable throwable) {
transitionToFailed(throwable);
}
});
} else {
transitionToFinished();
}
return true;
}
use of javax.annotation.Nullable in project presto by prestodb.
the class ExchangeClient method getNextPage.
@Nullable
public SerializedPage getNextPage(Duration maxWaitTime) throws InterruptedException {
checkState(!Thread.holdsLock(this), "Can not get next page while holding a lock on this");
throwIfFailed();
if (closed.get()) {
return null;
}
scheduleRequestIfNecessary();
SerializedPage page = pageBuffer.poll();
// only wait for a page if we have remote clients
if (page == null && maxWaitTime.toMillis() >= 1 && !allClients.isEmpty()) {
page = pageBuffer.poll(maxWaitTime.toMillis(), TimeUnit.MILLISECONDS);
}
return postProcessPage(page);
}
use of javax.annotation.Nullable in project querydsl by querydsl.
the class AbstractSQLQuery method fetchOne.
@SuppressWarnings("unchecked")
@Override
@Nullable
public T fetchOne() {
if (getMetadata().getModifiers().getLimit() == null) {
limit(2);
}
Query query = createQuery(false);
Object rv = execute(query, false);
if (rv instanceof List) {
List<?> list = (List<?>) rv;
if (!list.isEmpty()) {
if (list.size() > 1) {
throw new NonUniqueResultException();
}
return (T) list.get(0);
} else {
return null;
}
} else {
return (T) rv;
}
}
use of javax.annotation.Nullable in project querydsl by querydsl.
the class GeoDBWkbType method getValue.
@Override
@Nullable
public Geometry getValue(ResultSet rs, int startIndex) throws SQLException {
byte[] bytes = rs.getBytes(startIndex);
if (bytes != null) {
byte[] wkb;
if (bytes[0] != 0 && bytes[0] != 1) {
// decodes EWKB
wkb = new byte[bytes.length - 32];
System.arraycopy(bytes, 32, wkb, 0, wkb.length);
} else {
wkb = bytes;
}
WkbDecoder decoder = Wkb.newDecoder(Wkb.Dialect.POSTGIS_EWKB_1);
return decoder.decode(ByteBuffer.from(wkb));
} else {
return null;
}
}
Aggregations