wgtmac commented on code in PR #152:
URL: https://github.com/apache/iceberg-cpp/pull/152#discussion_r2238166054


##########
src/iceberg/catalog/in_memory_catalog.h:
##########
@@ -93,6 +93,10 @@ class ICEBERG_EXPORT InMemoryCatalog
   std::unique_ptr<iceberg::TableBuilder> BuildTable(const TableIdentifier& 
identifier,
                                                     const Schema& schema) 
const override;
 
+ protected:
+  Status UpdateTableMetaLocationInternal(const TableIdentifier& identifier,

Review Comment:
   Please remove this function. We need to use GMock to update the location 
without hacking any API.



##########
test/mock_catalog.h:
##########
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#pragma once
+
+#include "iceberg/catalog/in_memory_catalog.h"
+
+namespace iceberg {
+
+class ICEBERG_EXPORT MockInMemoryCatalog : public InMemoryCatalog {

Review Comment:
   Please take a look at 
https://google.github.io/googletest/gmock_for_dummies.html#writing-the-mock-class
 to use `MOCK_METHOD` to override functions of Catalog. Then you can use 
`EXPECT_CALL` with `WillOnce` of `MockCatalog::LoadTable` to mock different 
returns for each time.



##########
src/iceberg/table.cc:
##########
@@ -21,16 +21,36 @@
 
 #include <algorithm>
 
+#include "iceberg/catalog.h"
 #include "iceberg/partition_spec.h"
 #include "iceberg/schema.h"
 #include "iceberg/sort_order.h"
 #include "iceberg/table_metadata.h"
 #include "iceberg/table_scan.h"
+#include "iceberg/util/macros.h"
 
 namespace iceberg {
 
 const std::string& Table::uuid() const { return metadata_->table_uuid; }
 
+Status Table::Refresh() {
+  if (!catalog_) {
+    return InvalidArgument("Refresh is not supported for table without a 
catalog");

Review Comment:
   ```suggestion
       return NotSupported("Refresh is not supported for table without a 
catalog");
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to