Skip to content

Commit

Permalink
2
Browse files Browse the repository at this point in the history
  • Loading branch information
xinyiZzz committed Dec 25, 2024
1 parent 55f2bcd commit 885ad5c
Showing 1 changed file with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@
import org.apache.arrow.memory.BufferAllocator;
import org.apache.arrow.memory.RootAllocator;
import org.apache.arrow.util.AutoCloseables;
import org.apache.arrow.vector.VarBinaryVector;
import org.apache.arrow.vector.VarCharVector;
import org.apache.arrow.vector.VectorSchemaRoot;
import org.apache.arrow.vector.ipc.WriteChannel;
import org.apache.arrow.vector.ipc.message.MessageSerializer;
import org.apache.arrow.vector.types.pojo.Schema;
import org.apache.arrow.vector.util.Text;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

Expand Down Expand Up @@ -508,10 +508,8 @@ public void getStreamTables(final CommandGetTables command, final CallContext co
// tableToFields = null;
// }

final Schema schema =
includeSchema
? FlightSqlProducer.Schemas.GET_TABLES_SCHEMA
: FlightSqlProducer.Schemas.GET_TABLES_SCHEMA_NO_SCHEMA;
final Schema schema = includeSchema ? FlightSqlProducer.Schemas.GET_TABLES_SCHEMA
: FlightSqlProducer.Schemas.GET_TABLES_SCHEMA_NO_SCHEMA;

try (VectorSchemaRoot vectorSchemaRoot = VectorSchemaRoot.create(schema, rootAllocator)) {
listener.start(vectorSchemaRoot);
Expand All @@ -521,7 +519,16 @@ public void getStreamTables(final CommandGetTables command, final CallContext co
VarCharVector schemaNameVector = (VarCharVector) vectorSchemaRoot.getVector("db_schema_name");
VarCharVector tableNameVector = (VarCharVector) vectorSchemaRoot.getVector("table_name");
VarCharVector tableTypeVector = (VarCharVector) vectorSchemaRoot.getVector("table_type");
VarBinaryVector schemaVector = (VarBinaryVector) vectorSchemaRoot.getVector("table_schema");
// VarBinaryVector schemaVector = (VarBinaryVector) vectorSchemaRoot.getVector("table_schema");

final int tablesCount = 0;
for (int i = 0; i < 0; i++) {
catalogNameVector.setNull(i);
schemaNameVector.setSafe(i, new Text("1111"));
tableTypeVector.setSafe(i, new Text("2222"));
tableNameVector.setSafe(i, new Text("3333"));
// schemaVector.setSafe(i, byte[]);
}

// final int tablesCount = getTablesResp.getTablesCount();
// final IntStream range = range(0, tablesCount);
Expand All @@ -547,8 +554,7 @@ public void getStreamTables(final CommandGetTables command, final CallContext co
// }
// });

// vectorSchemaRoot.setRowCount(tablesCount);
vectorSchemaRoot.setRowCount(0);
vectorSchemaRoot.setRowCount(tablesCount);
listener.putNext();
listener.completed();
}
Expand Down

0 comments on commit 885ad5c

Please sign in to comment.