@@ -180,10 +180,9 @@ TEST(FileSystemCatalogTest, TestCreateTableWithBlob) {
180180 ASSERT_OK_AND_ASSIGN (std::vector<std::string> table_names, catalog.ListTables (" db1" ));
181181 ASSERT_EQ (1 , table_names.size ());
182182 ASSERT_EQ (table_names[0 ], " tbl1" );
183- ASSERT_OK_AND_ASSIGN (std::optional<std:: shared_ptr<Schema> > table_schema,
183+ ASSERT_OK_AND_ASSIGN (std::shared_ptr<Schema> table_schema,
184184 catalog.LoadTableSchema (Identifier (" db1" , " tbl1" )));
185- ASSERT_TRUE (table_schema.has_value ());
186- ASSERT_OK_AND_ASSIGN (auto arrow_schema, (*table_schema)->GetArrowSchema ());
185+ ASSERT_OK_AND_ASSIGN (auto arrow_schema, table_schema->GetArrowSchema ());
187186 auto loaded_schema = arrow::ImportSchema (arrow_schema.get ()).ValueOrDie ();
188187 ASSERT_TRUE (typed_schema.Equals (loaded_schema));
189188 ArrowSchemaRelease (&schema);
@@ -336,32 +335,32 @@ TEST(FileSystemCatalogTest, TestValidateTableSchema) {
336335 ASSERT_OK (catalog.CreateTable (Identifier (" db1" , " tbl1" ), &schema, {" f1" }, {}, options,
337336 /* ignore_if_exists=*/ false ));
338337
339- ASSERT_OK_AND_ASSIGN (std::optional<std::shared_ptr<Schema>> table_schema,
340- catalog.LoadTableSchema (Identifier (" db0" , " tbl0" )));
341- ASSERT_FALSE (table_schema.has_value ());
342- ASSERT_OK_AND_ASSIGN (table_schema, catalog.LoadTableSchema (Identifier (" db1" , " tbl1" )));
343- ASSERT_TRUE (table_schema.has_value ());
344- ASSERT_EQ (0 , (*table_schema)->Id ());
345- ASSERT_EQ (3 , (*table_schema)->HighestFieldId ());
346- ASSERT_EQ (1 , (*table_schema)->PartitionKeys ().size ());
347- ASSERT_EQ (0 , (*table_schema)->PrimaryKeys ().size ());
348- ASSERT_EQ (-1 , (*table_schema)->NumBuckets ());
349- ASSERT_FALSE ((*table_schema)->Comment ().has_value ());
350- std::vector<std::string> field_names = (*table_schema)->FieldNames ();
338+ ASSERT_NOK_WITH_MSG (catalog.LoadTableSchema (Identifier (" db0" , " tbl0" )),
339+ " Identifier{database=\' db0\' , table=\' tbl0\' } not exist" );
340+ ASSERT_OK_AND_ASSIGN (std::shared_ptr<Schema> table_schema,
341+ catalog.LoadTableSchema (Identifier (" db1" , " tbl1" )));
342+ ASSERT_EQ (0 , table_schema->Id ());
343+ ASSERT_EQ (3 , table_schema->HighestFieldId ());
344+ ASSERT_EQ (1 , table_schema->PartitionKeys ().size ());
345+ ASSERT_EQ (0 , table_schema->PrimaryKeys ().size ());
346+ ASSERT_EQ (-1 , table_schema->NumBuckets ());
347+ ASSERT_FALSE (table_schema->Comment ().has_value ());
348+ std::vector<std::string> field_names = table_schema->FieldNames ();
351349 std::vector<std::string> expected_field_names = {" f0" , " f1" , " f2" , " f3" };
352350 ASSERT_EQ (field_names, expected_field_names);
353351
354- ASSERT_OK_AND_ASSIGN (auto arrow_schema, (* table_schema) ->GetArrowSchema ());
352+ ASSERT_OK_AND_ASSIGN (auto arrow_schema, table_schema->GetArrowSchema ());
355353 auto loaded_schema = arrow::ImportSchema (arrow_schema.get ()).ValueOrDie ();
356354 ASSERT_TRUE (typed_schema.Equals (loaded_schema));
357355
358356 ASSERT_OK_AND_ASSIGN (auto fs, FileSystemFactory::Get (" local" , dir->Str (), {}));
359357 ASSERT_OK (fs->Delete (PathUtil::JoinPath (dir->Str (), " db1.db/tbl1/schema/schema-0" )));
360- ASSERT_OK_AND_ASSIGN (table_schema, catalog.LoadTableSchema (Identifier (" db1" , " tbl1" )));
361- ASSERT_FALSE (table_schema.has_value ());
358+
359+ ASSERT_NOK_WITH_MSG (catalog.LoadTableSchema (Identifier (" db1" , " tbl1" )),
360+ " Identifier{database=\' db1\' , table=\' tbl1\' } not exist" );
362361
363362 ASSERT_NOK_WITH_MSG (catalog.LoadTableSchema (Identifier (" db1" , " tbl$11" )),
364- " do not support loading schema for system table." );
363+ " do not support checking TableSchemaExists for system table." );
365364 ArrowSchemaRelease (&schema);
366365}
367366
0 commit comments