Skip to content

Commit 5606630

Browse files
committed
fix: complete global system table review feedback
1 parent d79ca7b commit 5606630

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,13 @@ class PartitionsSystemTable : public InMemorySystemTable {
108108
class GlobalSystemTableLoader {
109109
public:
110110
static Result<bool> IsSupported(const std::string& table_name,
111-
const std::map<std::string, std::string>& catalog_options = {});
111+
const std::map<std::string, std::string>& catalog_options);
112112

113113
static Result<std::shared_ptr<SystemTable>> Load(const std::string& table_name,
114114
const GlobalSystemTableContext& context);
115115

116116
static Result<std::vector<std::string>> GetSupportedTableNames(
117-
const std::map<std::string, std::string>& catalog_options = {});
117+
const std::map<std::string, std::string>& catalog_options);
118118
};
119119

120120
} // namespace paimon

test/inte/read_inte_test.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3537,6 +3537,13 @@ TEST(SystemTableReadInteTest, TestReadGlobalTables) {
35373537
/*ignore_if_exists=*/false));
35383538
ArrowSchemaRelease(&schema);
35393539

3540+
::ArrowSchema no_pk_schema;
3541+
ASSERT_TRUE(arrow::ExportSchema(*typed_schema, &no_pk_schema).ok());
3542+
ASSERT_OK(catalog->CreateTable(Identifier("test_db", "test_no_pk_tbl"), &no_pk_schema,
3543+
/*partition_keys=*/{}, /*primary_keys=*/{}, options,
3544+
/*ignore_if_exists=*/false));
3545+
ArrowSchemaRelease(&no_pk_schema);
3546+
35403547
ASSERT_OK_AND_ASSIGN(auto result,
35413548
ReadGlobalSystemTable("tables", catalog.get(), fs, warehouse, options));
35423549
auto struct_array = SingleStructChunk(result);
@@ -3573,6 +3580,7 @@ TEST(SystemTableReadInteTest, TestReadGlobalTables) {
35733580

35743581
// Find our table by table name
35753582
bool found = false;
3583+
bool found_no_pk = false;
35763584
for (int64_t i = 0; i < struct_array->length(); ++i) {
35773585
if (std::string(tbl_array->GetString(i)) == "test_tbl") {
35783586
EXPECT_EQ(std::string(db_array->GetString(i)), "test_db");
@@ -3586,9 +3594,13 @@ TEST(SystemTableReadInteTest, TestReadGlobalTables) {
35863594
EXPECT_EQ(updated_by_array->GetString(i), "updater");
35873595
EXPECT_TRUE(record_count_array->IsNull(i));
35883596
found = true;
3597+
} else if (std::string(tbl_array->GetString(i)) == "test_no_pk_tbl") {
3598+
EXPECT_FALSE(pk_array->Value(i));
3599+
found_no_pk = true;
35893600
}
35903601
}
35913602
ASSERT_TRUE(found) << "table not found in sys.tables";
3603+
ASSERT_TRUE(found_no_pk) << "no-PK table not found in sys.tables";
35923604
}
35933605

35943606
TEST(SystemTableReadInteTest, TestReadGlobalPartitions) {

0 commit comments

Comments
 (0)