@@ -5819,19 +5819,38 @@ TabletImpl::GetSystemTableIterator() {
58195819 return [this ](const std::string& table_name)
58205820 -> std::optional<std::pair<std::unique_ptr<::openmldb::catalog::FullTableIterator>,
58215821 std::unique_ptr<openmldb::codec::Schema>>> {
5822- for (const auto & [tid, tables] : tables_) {
5823- for (const auto & [pid, table] : tables) {
5824- if (table->GetName () == table_name) {
5825- std::map<uint32_t , std::shared_ptr<::openmldb::client::TabletClient>> empty_tablet_clients;
5826- auto user_table = std::make_shared<std::map<uint32_t , std::shared_ptr<::openmldb::storage::Table>>>(
5827- std::map<uint32_t , std::shared_ptr<::openmldb::storage::Table>>{{pid, table}});
5828- return {{std::make_unique<::openmldb::catalog::FullTableIterator>(table->GetId (), user_table,
5829- empty_tablet_clients),
5830- std::make_unique<::openmldb::codec::Schema>(table->GetTableMeta ()->column_desc ())}};
5831- }
5832- }
5822+ auto handler = catalog_->GetTable (::openmldb::nameserver::INTERNAL_DB, ::openmldb::nameserver::USER_INFO_NAME);
5823+ if (!handler) {
5824+ PDLOG (WARNING, " no user table tablehandler" );
5825+ return std::nullopt ;
5826+ }
5827+ auto tablet_table_handler = std::dynamic_pointer_cast<catalog::TabletTableHandler>(handler);
5828+ if (!tablet_table_handler) {
5829+ PDLOG (WARNING, " convert user table tablehandler failed" );
5830+ return std::nullopt ;
5831+ }
5832+ auto table_client_manager = tablet_table_handler->GetTableClientManager ();
5833+ if (table_client_manager == nullptr ) {
5834+ return std::nullopt ;
5835+ }
5836+ auto tablet = table_client_manager->GetTablet (0 );
5837+ if (tablet == nullptr ) {
5838+ return std::nullopt ;
5839+ }
5840+ auto client = tablet->GetClient ();
5841+ if (client == nullptr ) {
5842+ return std::nullopt ;
5843+ }
5844+
5845+ auto schema = std::make_unique<::openmldb::codec::Schema>();
5846+
5847+ if (openmldb::schema::SchemaAdapter::ConvertSchema (*tablet_table_handler->GetSchema (), schema.get ())) {
5848+ std::map<uint32_t , std::shared_ptr<::openmldb::client::TabletClient>> tablet_clients = {{0 , client}};
5849+ return {{std::make_unique<catalog::FullTableIterator>(tablet_table_handler->GetTid (), nullptr , tablet_clients),
5850+ std::move (schema)}};
5851+ } else {
5852+ return std::nullopt ;
58335853 }
5834- return std::nullopt ;
58355854 };
58365855}
58375856
0 commit comments