@@ -3901,6 +3901,13 @@ TEST(SystemTableReadInteTest, TestReadGlobalTables) {
39013901 /* ignore_if_exists=*/ false ));
39023902 ArrowSchemaRelease (&schema);
39033903
3904+ ::ArrowSchema no_pk_schema;
3905+ ASSERT_TRUE (arrow::ExportSchema (*typed_schema, &no_pk_schema).ok ());
3906+ ASSERT_OK (catalog->CreateTable (Identifier (" test_db" , " test_no_pk_tbl" ), &no_pk_schema,
3907+ /* partition_keys=*/ {}, /* primary_keys=*/ {}, options,
3908+ /* ignore_if_exists=*/ false ));
3909+ ArrowSchemaRelease (&no_pk_schema);
3910+
39043911 ASSERT_OK_AND_ASSIGN (auto result,
39053912 ReadGlobalSystemTable (" tables" , catalog.get (), fs, warehouse, options));
39063913 auto struct_array = SingleStructChunk (result);
@@ -3937,6 +3944,7 @@ TEST(SystemTableReadInteTest, TestReadGlobalTables) {
39373944
39383945 // Find our table by table name
39393946 bool found = false ;
3947+ bool found_no_pk = false ;
39403948 for (int64_t i = 0 ; i < struct_array->length (); ++i) {
39413949 if (std::string (tbl_array->GetString (i)) == " test_tbl" ) {
39423950 EXPECT_EQ (std::string (db_array->GetString (i)), " test_db" );
@@ -3950,9 +3958,13 @@ TEST(SystemTableReadInteTest, TestReadGlobalTables) {
39503958 EXPECT_EQ (updated_by_array->GetString (i), " updater" );
39513959 EXPECT_TRUE (record_count_array->IsNull (i));
39523960 found = true ;
3961+ } else if (std::string (tbl_array->GetString (i)) == " test_no_pk_tbl" ) {
3962+ EXPECT_FALSE (pk_array->Value (i));
3963+ found_no_pk = true ;
39533964 }
39543965 }
39553966 ASSERT_TRUE (found) << " table not found in sys.tables" ;
3967+ ASSERT_TRUE (found_no_pk) << " no-PK table not found in sys.tables" ;
39563968}
39573969
39583970TEST (SystemTableReadInteTest, TestReadGlobalPartitions) {
0 commit comments