Skip to content

Commit

Permalink
Checker framework fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jduo committed Feb 17, 2024
1 parent 8c4d414 commit 711978e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.apache.arrow.flight.Location;
import org.apache.arrow.memory.BufferAllocator;
import org.apache.arrow.util.AutoCloseables;
import org.apache.arrow.util.Preconditions;
import org.apache.arrow.vector.VectorSchemaRoot;
import org.apache.arrow.vector.VectorUnloader;
import org.apache.arrow.vector.ipc.ArrowReader;
Expand Down Expand Up @@ -64,7 +65,7 @@ protected BaseFlightReader(

@Override
public boolean loadNextBatch() throws IOException {
assert (currentStream != null);
Preconditions.checkNotNull(currentStream);
if (!currentStream.next()) {
if (nextEndpointIndex >= flightEndpoints.size()) {
return false;
Expand Down Expand Up @@ -93,7 +94,7 @@ public boolean loadNextBatch() throws IOException {

@Override
protected Schema readSchema() throws IOException {
assert (schema != null);
Preconditions.checkNotNull(currentStream);
return schema;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.apache.arrow.flight.Location;
import org.apache.arrow.flight.sql.impl.FlightSql;
import org.apache.arrow.memory.BufferAllocator;
import org.apache.arrow.util.Preconditions;
import org.apache.arrow.vector.UInt4Vector;
import org.apache.arrow.vector.VarCharVector;
import org.apache.arrow.vector.VectorSchemaRoot;
Expand Down Expand Up @@ -74,12 +75,14 @@ void accept(
SUPPORTED_CODES.put(
FlightSql.SqlInfo.FLIGHT_SQL_SERVER_NAME.getNumber(),
(b, sqlInfo, srcIndex, dstIndex) -> {
Preconditions.checkNotNull(b.infoCodes);
b.infoCodes.setSafe(dstIndex, AdbcInfoCode.VENDOR_NAME.getValue());
b.setStringValue(dstIndex, sqlInfo.getVarCharVector(STRING_VALUE_TYPE_ID).get(srcIndex));
});
SUPPORTED_CODES.put(
FlightSql.SqlInfo.FLIGHT_SQL_SERVER_VERSION.getNumber(),
(b, sqlInfo, srcIndex, dstIndex) -> {
Preconditions.checkNotNull(b.infoCodes);
b.infoCodes.setSafe(dstIndex, AdbcInfoCode.VENDOR_VERSION.getValue());
b.setStringValue(dstIndex, sqlInfo.getVarCharVector(STRING_VALUE_TYPE_ID).get(srcIndex));
});
Expand Down Expand Up @@ -126,6 +129,7 @@ static GetInfoMetadataReader CreateGetInfoMetadataReader(
}

void setStringValue(int index, byte[] value) {
Preconditions.checkNotNull(infoValues, stringValues);
infoValues.setValueCount(index + 1);
infoValues.setTypeId(index, STRING_VALUE_TYPE_ID);
stringValues.setSafe(index, value);
Expand Down

0 comments on commit 711978e

Please sign in to comment.