Skip to content

Commit 92de892

Browse files
committed
improve: add table_type detection and clearer TODO for manifest-dependent fields
1 parent 6514d09 commit 92de892

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

src/paimon/core/table/system/global_system_tables.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "paimon/common/utils/string_utils.h"
3434
#include "paimon/common/utils/path_util.h"
3535
#include "paimon/core/core_options.h"
36+
#include "paimon/defs.h"
3637
#include "paimon/core/schema/schema_manager.h"
3738
#include "paimon/core/schema/table_schema.h"
3839
#include "paimon/core/snapshot.h"
@@ -253,11 +254,12 @@ Result<std::vector<GenericRow>> TablesSystemTable::BuildRows() const {
253254
continue;
254255
}
255256

256-
// Determine table type
257+
// Determine table type: EXTERNAL if data-file.external-paths is set
257258
std::string table_type_str = "MANAGED";
258-
// Check if table has external path in options
259-
const auto& options = data_schema->Options();
260-
// (simplified: could check for external path options)
259+
const auto& opts = data_schema->Options();
260+
if (opts.find(Options::DATA_FILE_EXTERNAL_PATHS) != opts.end()) {
261+
table_type_str = "EXTERNAL";
262+
}
261263

262264
bool partitioned = !data_schema->PartitionKeys().empty();
263265
std::string primary_keys_str;
@@ -287,8 +289,10 @@ Result<std::vector<GenericRow>> TablesSystemTable::BuildRows() const {
287289
auto total_count = snapshot.TotalRecordCount();
288290
row.SetField(5, total_count ? VariantType(total_count.value())
289291
: VariantType(NullType()));
290-
// file_size and file_count not available from Snapshot alone;
291-
// leave as null for now
292+
// TODO(suxiaogang223): Populate file_size_in_bytes, file_count, and
293+
// last_file_creation_time by reading manifest entries. This requires
294+
// the manifest reading infrastructure from the files/manifests system
295+
// tables PR (codex/system-table-files-manifests-pr4).
292296
row.SetField(6, NullType());
293297
row.SetField(7, NullType());
294298
row.SetField(8, NullType());

0 commit comments

Comments
 (0)