@@ -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
35943606TEST (SystemTableReadInteTest, TestReadGlobalPartitions) {
0 commit comments