Skip to content

Commit

Permalink
Linter
Browse files Browse the repository at this point in the history
Also call root.allocateNew() in GetInfoReader
  • Loading branch information
jduo committed Feb 17, 2024
1 parent 47caa0e commit f540c72
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ public boolean loadNextBatch() throws IOException {
hasInMemoryDataBeenWritten = true;
int dstIndex = 0;
try (VectorSchemaRoot root = VectorSchemaRoot.create(readSchema(), allocator)) {
root.allocateNew();
this.infoCodes = (UInt4Vector) root.getVector(0);

if (requestedCodes.contains(AdbcInfoCode.DRIVER_NAME.getValue())) {
Expand Down Expand Up @@ -184,6 +185,7 @@ protected Schema readSchema() {
@Override
protected void processRootFromStream(VectorSchemaRoot root) {
try (VectorSchemaRoot tmpRoot = VectorSchemaRoot.create(readSchema(), allocator)) {
root.allocateNew();
this.infoCodes = (UInt4Vector) tmpRoot.getVector(0);
this.infoValues = (DenseUnionVector) tmpRoot.getVector(1);
this.stringValues = this.infoValues.getVarCharVector((byte) 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ protected VectorSchemaRoot getAggregateRoot() {
}

private static class GetCatalogsMetadataReader extends GetObjectMetadataReader {
private final @Nullable Pattern catalogPattern;
private final @Nullable Pattern catalogPattern;

protected GetCatalogsMetadataReader(
BufferAllocator allocator,
Expand Down Expand Up @@ -351,7 +351,7 @@ private static class TableDefinition {

private final String catalogPattern;
private final String dbSchemaPattern;
private final @Nullable Pattern compiledColumnNamePattern;
private final @Nullable Pattern compiledColumnNamePattern;
private final boolean shouldGetColumns;
private final Map<String, Map<String, Map<String, TableDefinition>>> tablePathToColumnsMap =
new LinkedHashMap<>();
Expand Down Expand Up @@ -490,11 +490,15 @@ protected void finish() throws AdbcException, IOException {
for (Object schemaStructObj : sourceSchemaStructList.getObject(i)) {
final Map<String, Object> schemaStructAsMap = (Map<String, Object>) schemaStructObj;
if (schemaStructAsMap == null) {
throw new IllegalStateException(String.format("Error in catalog %s: Null schema encountered when schemas were requested.", catalog));
throw new IllegalStateException(
String.format(
"Error in catalog %s: Null schema encountered when schemas were requested.",
catalog));
}
Object schemaNameObj = schemaStructAsMap.get("db_schema_name");
if (schemaNameObj == null) {
throw new IllegalStateException(String.format("Error in catalog %s: Schema with no name encountered.", catalog));
throw new IllegalStateException(
String.format("Error in catalog %s: Schema with no name encountered.", catalog));
}
String schemaName = schemaNameObj.toString();

Expand Down

0 comments on commit f540c72

Please sign in to comment.