This is an automated email from the ASF dual-hosted git repository.

gangwu pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-cpp.git


The following commit(s) were added to refs/heads/main by this push:
     new e2d6496e chore: consolidate json serde file names (#539)
e2d6496e is described below

commit e2d6496e0d3e1fb157aee4b2701fbffdcbc84205
Author: Junwang Zhao <[email protected]>
AuthorDate: Wed Jan 28 10:33:24 2026 +0800

    chore: consolidate json serde file names (#539)
    
    We have the convention that only header files should use the `_internal`
    suffix, so that iceberg_install_all_headers does not install them.
    However, we have some existing .cc files with the
     _internal suffix, which should be fixed.
    
    This commit only addresses json_internal.h/.cc, since we discussed
    renaming them to json_serde_internal.h and json_serde.cc in #534
---
 src/iceberg/CMakeLists.txt                                |  2 +-
 src/iceberg/catalog/rest/CMakeLists.txt                   |  2 +-
 src/iceberg/catalog/rest/http_client.cc                   |  4 ++--
 .../catalog/rest/{json_internal.cc => json_serde.cc}      |  5 ++---
 .../rest/{json_internal.h => json_serde_internal.h}       |  2 +-
 src/iceberg/catalog/rest/meson.build                      |  2 +-
 src/iceberg/catalog/rest/rest_catalog.cc                  |  4 ++--
 src/iceberg/{json_internal.cc => json_serde.cc}           | 15 ++++-----------
 src/iceberg/{json_internal.h => json_serde_internal.h}    |  0
 src/iceberg/manifest/v1_metadata.cc                       |  2 +-
 src/iceberg/manifest/v2_metadata.cc                       |  2 +-
 src/iceberg/manifest/v3_metadata.cc                       |  2 +-
 src/iceberg/meson.build                                   |  2 +-
 src/iceberg/table_metadata.cc                             |  2 +-
 src/iceberg/test/CMakeLists.txt                           |  4 ++--
 .../test/{json_internal_test.cc => json_serde_test.cc}    |  3 +--
 src/iceberg/test/meson.build                              |  4 ++--
 src/iceberg/test/metadata_io_test.cc                      |  2 +-
 src/iceberg/test/partition_spec_test.cc                   |  2 +-
 src/iceberg/test/rest_catalog_test.cc                     |  2 +-
 ...rest_json_internal_test.cc => rest_json_serde_test.cc} |  2 +-
 src/iceberg/test/schema_json_test.cc                      |  2 +-
 src/iceberg/test/test_resource.h                          |  2 +-
 23 files changed, 30 insertions(+), 39 deletions(-)

diff --git a/src/iceberg/CMakeLists.txt b/src/iceberg/CMakeLists.txt
index d82229ef..5d3ff33b 100644
--- a/src/iceberg/CMakeLists.txt
+++ b/src/iceberg/CMakeLists.txt
@@ -42,7 +42,7 @@ set(ICEBERG_SOURCES
     file_reader.cc
     file_writer.cc
     inheritable_metadata.cc
-    json_internal.cc
+    json_serde.cc
     location_provider.cc
     manifest/manifest_adapter.cc
     manifest/manifest_entry.cc
diff --git a/src/iceberg/catalog/rest/CMakeLists.txt 
b/src/iceberg/catalog/rest/CMakeLists.txt
index b73d7fcf..1da47d68 100644
--- a/src/iceberg/catalog/rest/CMakeLists.txt
+++ b/src/iceberg/catalog/rest/CMakeLists.txt
@@ -25,7 +25,7 @@ set(ICEBERG_REST_SOURCES
     endpoint.cc
     error_handlers.cc
     http_client.cc
-    json_internal.cc
+    json_serde.cc
     resource_paths.cc
     rest_catalog.cc
     rest_util.cc
diff --git a/src/iceberg/catalog/rest/http_client.cc 
b/src/iceberg/catalog/rest/http_client.cc
index 41be14ce..82a118c5 100644
--- a/src/iceberg/catalog/rest/http_client.cc
+++ b/src/iceberg/catalog/rest/http_client.cc
@@ -24,9 +24,9 @@
 
 #include "iceberg/catalog/rest/constant.h"
 #include "iceberg/catalog/rest/error_handlers.h"
-#include "iceberg/catalog/rest/json_internal.h"
+#include "iceberg/catalog/rest/json_serde_internal.h"
 #include "iceberg/catalog/rest/rest_util.h"
-#include "iceberg/json_internal.h"
+#include "iceberg/json_serde_internal.h"
 #include "iceberg/result.h"
 #include "iceberg/util/macros.h"
 
diff --git a/src/iceberg/catalog/rest/json_internal.cc 
b/src/iceberg/catalog/rest/json_serde.cc
similarity index 99%
rename from src/iceberg/catalog/rest/json_internal.cc
rename to src/iceberg/catalog/rest/json_serde.cc
index b9c4caca..727881f6 100644
--- a/src/iceberg/catalog/rest/json_internal.cc
+++ b/src/iceberg/catalog/rest/json_serde.cc
@@ -17,8 +17,6 @@
  * under the License.
  */
 
-#include "iceberg/catalog/rest/json_internal.h"
-
 #include <memory>
 #include <string>
 #include <utility>
@@ -26,8 +24,9 @@
 
 #include <nlohmann/json.hpp>
 
+#include "iceberg/catalog/rest/json_serde_internal.h"
 #include "iceberg/catalog/rest/types.h"
-#include "iceberg/json_internal.h"
+#include "iceberg/json_serde_internal.h"
 #include "iceberg/partition_spec.h"
 #include "iceberg/sort_order.h"
 #include "iceberg/table_identifier.h"
diff --git a/src/iceberg/catalog/rest/json_internal.h 
b/src/iceberg/catalog/rest/json_serde_internal.h
similarity index 98%
rename from src/iceberg/catalog/rest/json_internal.h
rename to src/iceberg/catalog/rest/json_serde_internal.h
index 081a0205..f8bdd78f 100644
--- a/src/iceberg/catalog/rest/json_internal.h
+++ b/src/iceberg/catalog/rest/json_serde_internal.h
@@ -25,7 +25,7 @@
 #include "iceberg/catalog/rest/types.h"
 #include "iceberg/result.h"
 
-/// \file iceberg/catalog/rest/json_internal.h
+/// \file iceberg/catalog/rest/json_serde_internal.h
 /// JSON serialization and deserialization for Iceberg REST Catalog API types.
 
 namespace iceberg::rest {
diff --git a/src/iceberg/catalog/rest/meson.build 
b/src/iceberg/catalog/rest/meson.build
index aaff255e..3a333963 100644
--- a/src/iceberg/catalog/rest/meson.build
+++ b/src/iceberg/catalog/rest/meson.build
@@ -23,7 +23,7 @@ iceberg_rest_sources = files(
     'endpoint.cc',
     'error_handlers.cc',
     'http_client.cc',
-    'json_internal.cc',
+    'json_serde.cc',
     'resource_paths.cc',
     'rest_catalog.cc',
     'rest_util.cc',
diff --git a/src/iceberg/catalog/rest/rest_catalog.cc 
b/src/iceberg/catalog/rest/rest_catalog.cc
index 5ab6e591..cc052e24 100644
--- a/src/iceberg/catalog/rest/rest_catalog.cc
+++ b/src/iceberg/catalog/rest/rest_catalog.cc
@@ -31,12 +31,12 @@
 #include "iceberg/catalog/rest/endpoint.h"
 #include "iceberg/catalog/rest/error_handlers.h"
 #include "iceberg/catalog/rest/http_client.h"
-#include "iceberg/catalog/rest/json_internal.h"
+#include "iceberg/catalog/rest/json_serde_internal.h"
 #include "iceberg/catalog/rest/resource_paths.h"
 #include "iceberg/catalog/rest/rest_catalog.h"
 #include "iceberg/catalog/rest/rest_util.h"
 #include "iceberg/catalog/rest/types.h"
-#include "iceberg/json_internal.h"
+#include "iceberg/json_serde_internal.h"
 #include "iceberg/partition_spec.h"
 #include "iceberg/result.h"
 #include "iceberg/schema.h"
diff --git a/src/iceberg/json_internal.cc b/src/iceberg/json_serde.cc
similarity index 99%
rename from src/iceberg/json_internal.cc
rename to src/iceberg/json_serde.cc
index 95883a93..93705f53 100644
--- a/src/iceberg/json_internal.cc
+++ b/src/iceberg/json_serde.cc
@@ -17,8 +17,6 @@
  * under the License.
  */
 
-#include "iceberg/json_internal.h"
-
 #include <algorithm>
 #include <cstdint>
 #include <format>
@@ -28,6 +26,7 @@
 
 #include <nlohmann/json.hpp>
 
+#include "iceberg/json_serde_internal.h"
 #include "iceberg/name_mapping.h"
 #include "iceberg/partition_field.h"
 #include "iceberg/partition_spec.h"
@@ -1397,15 +1396,9 @@ nlohmann::json ToJson(const TableUpdate& update) {
       json[kRefName] = u.ref_name();
       json[kSnapshotId] = u.snapshot_id();
       json[kType] = ToString(u.type());
-      if (u.min_snapshots_to_keep().has_value()) {
-        json[kMinSnapshotsToKeep] = u.min_snapshots_to_keep().value();
-      }
-      if (u.max_snapshot_age_ms().has_value()) {
-        json[kMaxSnapshotAgeMs] = u.max_snapshot_age_ms().value();
-      }
-      if (u.max_ref_age_ms().has_value()) {
-        json[kMaxRefAgeMs] = u.max_ref_age_ms().value();
-      }
+      SetOptionalField(json, kMinSnapshotsToKeep, u.min_snapshots_to_keep());
+      SetOptionalField(json, kMaxSnapshotAgeMs, u.max_snapshot_age_ms());
+      SetOptionalField(json, kMaxRefAgeMs, u.max_ref_age_ms());
       break;
     }
     case TableUpdate::Kind::kSetProperties: {
diff --git a/src/iceberg/json_internal.h b/src/iceberg/json_serde_internal.h
similarity index 100%
rename from src/iceberg/json_internal.h
rename to src/iceberg/json_serde_internal.h
diff --git a/src/iceberg/manifest/v1_metadata.cc 
b/src/iceberg/manifest/v1_metadata.cc
index f4960c20..cb3b895b 100644
--- a/src/iceberg/manifest/v1_metadata.cc
+++ b/src/iceberg/manifest/v1_metadata.cc
@@ -19,7 +19,7 @@
 
 #include <memory>
 
-#include "iceberg/json_internal.h"
+#include "iceberg/json_serde_internal.h"
 #include "iceberg/manifest/manifest_entry.h"
 #include "iceberg/manifest/manifest_list.h"
 #include "iceberg/manifest/v1_metadata_internal.h"
diff --git a/src/iceberg/manifest/v2_metadata.cc 
b/src/iceberg/manifest/v2_metadata.cc
index e5c54fca..d42e9f07 100644
--- a/src/iceberg/manifest/v2_metadata.cc
+++ b/src/iceberg/manifest/v2_metadata.cc
@@ -18,7 +18,7 @@
  */
 
 #include "iceberg/constants.h"
-#include "iceberg/json_internal.h"
+#include "iceberg/json_serde_internal.h"
 #include "iceberg/manifest/manifest_entry.h"
 #include "iceberg/manifest/manifest_list.h"
 #include "iceberg/manifest/v2_metadata_internal.h"
diff --git a/src/iceberg/manifest/v3_metadata.cc 
b/src/iceberg/manifest/v3_metadata.cc
index 35a1a89d..9148e067 100644
--- a/src/iceberg/manifest/v3_metadata.cc
+++ b/src/iceberg/manifest/v3_metadata.cc
@@ -21,7 +21,7 @@
 #include <optional>
 
 #include "iceberg/constants.h"
-#include "iceberg/json_internal.h"
+#include "iceberg/json_serde_internal.h"
 #include "iceberg/manifest/manifest_entry.h"
 #include "iceberg/manifest/manifest_list.h"
 #include "iceberg/manifest/v3_metadata_internal.h"
diff --git a/src/iceberg/meson.build b/src/iceberg/meson.build
index 651de782..fd82a889 100644
--- a/src/iceberg/meson.build
+++ b/src/iceberg/meson.build
@@ -60,7 +60,7 @@ iceberg_sources = files(
     'file_reader.cc',
     'file_writer.cc',
     'inheritable_metadata.cc',
-    'json_internal.cc',
+    'json_serde.cc',
     'location_provider.cc',
     'manifest/manifest_adapter.cc',
     'manifest/manifest_entry.cc',
diff --git a/src/iceberg/table_metadata.cc b/src/iceberg/table_metadata.cc
index 7dab6704..d3b5629c 100644
--- a/src/iceberg/table_metadata.cc
+++ b/src/iceberg/table_metadata.cc
@@ -37,7 +37,7 @@
 #include "iceberg/constants.h"
 #include "iceberg/exception.h"
 #include "iceberg/file_io.h"
-#include "iceberg/json_internal.h"
+#include "iceberg/json_serde_internal.h"
 #include "iceberg/metrics_config.h"
 #include "iceberg/partition_field.h"
 #include "iceberg/partition_spec.h"
diff --git a/src/iceberg/test/CMakeLists.txt b/src/iceberg/test/CMakeLists.txt
index f3c8aea9..ae61d819 100644
--- a/src/iceberg/test/CMakeLists.txt
+++ b/src/iceberg/test/CMakeLists.txt
@@ -101,7 +101,7 @@ add_iceberg_test(expression_test
 
 add_iceberg_test(json_serde_test
                  SOURCES
-                 json_internal_test.cc
+                 json_serde_test.cc
                  metadata_serde_test.cc
                  schema_json_test.cc)
 
@@ -216,7 +216,7 @@ if(ICEBERG_BUILD_REST)
   add_rest_iceberg_test(rest_catalog_test
                         SOURCES
                         endpoint_test.cc
-                        rest_json_internal_test.cc
+                        rest_json_serde_test.cc
                         rest_util_test.cc)
 
   if(ICEBERG_BUILD_REST_INTEGRATION_TESTS)
diff --git a/src/iceberg/test/json_internal_test.cc 
b/src/iceberg/test/json_serde_test.cc
similarity index 99%
rename from src/iceberg/test/json_internal_test.cc
rename to src/iceberg/test/json_serde_test.cc
index 8fa24312..f019375d 100644
--- a/src/iceberg/test/json_internal_test.cc
+++ b/src/iceberg/test/json_serde_test.cc
@@ -17,14 +17,13 @@
  * under the License.
  */
 
-#include "iceberg/json_internal.h"
-
 #include <memory>
 
 #include <gmock/gmock.h>
 #include <gtest/gtest.h>
 #include <nlohmann/json.hpp>
 
+#include "iceberg/json_serde_internal.h"
 #include "iceberg/name_mapping.h"
 #include "iceberg/partition_spec.h"
 #include "iceberg/schema.h"
diff --git a/src/iceberg/test/meson.build b/src/iceberg/test/meson.build
index 5e3007c4..bf73dd13 100644
--- a/src/iceberg/test/meson.build
+++ b/src/iceberg/test/meson.build
@@ -75,7 +75,7 @@ iceberg_tests = {
     },
     'json_serde_test': {
         'sources': files(
-            'json_internal_test.cc',
+            'json_serde_test.cc',
             'metadata_serde_test.cc',
             'schema_json_test.cc',
         ),
@@ -103,7 +103,7 @@ iceberg_tests = {
 if get_option('rest').enabled()
     iceberg_tests += {
         'rest_catalog_test': {
-            'sources': files('rest_json_internal_test.cc', 
'rest_util_test.cc'),
+            'sources': files('rest_json_serde_test.cc', 'rest_util_test.cc'),
             'dependencies': [iceberg_rest_dep],
         },
     }
diff --git a/src/iceberg/test/metadata_io_test.cc 
b/src/iceberg/test/metadata_io_test.cc
index 16661235..72a23ecb 100644
--- a/src/iceberg/test/metadata_io_test.cc
+++ b/src/iceberg/test/metadata_io_test.cc
@@ -29,7 +29,7 @@
 
 #include "iceberg/arrow/arrow_fs_file_io_internal.h"
 #include "iceberg/file_io.h"
-#include "iceberg/json_internal.h"
+#include "iceberg/json_serde_internal.h"
 #include "iceberg/partition_spec.h"
 #include "iceberg/result.h"
 #include "iceberg/schema.h"
diff --git a/src/iceberg/test/partition_spec_test.cc 
b/src/iceberg/test/partition_spec_test.cc
index 6f1b4995..89c4cdc8 100644
--- a/src/iceberg/test/partition_spec_test.cc
+++ b/src/iceberg/test/partition_spec_test.cc
@@ -26,7 +26,7 @@
 #include <gtest/gtest.h>
 #include <nlohmann/json.hpp>
 
-#include "iceberg/json_internal.h"
+#include "iceberg/json_serde_internal.h"
 #include "iceberg/partition_field.h"
 #include "iceberg/row/partition_values.h"
 #include "iceberg/schema.h"
diff --git a/src/iceberg/test/rest_catalog_test.cc 
b/src/iceberg/test/rest_catalog_test.cc
index f17b9391..20560979 100644
--- a/src/iceberg/test/rest_catalog_test.cc
+++ b/src/iceberg/test/rest_catalog_test.cc
@@ -39,7 +39,7 @@
 #include "iceberg/catalog/rest/catalog_properties.h"
 #include "iceberg/catalog/rest/error_handlers.h"
 #include "iceberg/catalog/rest/http_client.h"
-#include "iceberg/catalog/rest/json_internal.h"
+#include "iceberg/catalog/rest/json_serde_internal.h"
 #include "iceberg/partition_spec.h"
 #include "iceberg/result.h"
 #include "iceberg/schema.h"
diff --git a/src/iceberg/test/rest_json_internal_test.cc 
b/src/iceberg/test/rest_json_serde_test.cc
similarity index 99%
rename from src/iceberg/test/rest_json_internal_test.cc
rename to src/iceberg/test/rest_json_serde_test.cc
index 24c099fc..9da052e6 100644
--- a/src/iceberg/test/rest_json_internal_test.cc
+++ b/src/iceberg/test/rest_json_serde_test.cc
@@ -23,7 +23,7 @@
 #include <gtest/gtest.h>
 #include <nlohmann/json.hpp>
 
-#include "iceberg/catalog/rest/json_internal.h"
+#include "iceberg/catalog/rest/json_serde_internal.h"
 #include "iceberg/catalog/rest/types.h"
 #include "iceberg/partition_spec.h"
 #include "iceberg/result.h"
diff --git a/src/iceberg/test/schema_json_test.cc 
b/src/iceberg/test/schema_json_test.cc
index da4c779a..87388cbb 100644
--- a/src/iceberg/test/schema_json_test.cc
+++ b/src/iceberg/test/schema_json_test.cc
@@ -24,7 +24,7 @@
 #include <gtest/gtest.h>
 #include <nlohmann/json.hpp>
 
-#include "iceberg/json_internal.h"
+#include "iceberg/json_serde_internal.h"
 #include "iceberg/schema.h"
 #include "iceberg/schema_field.h"
 #include "iceberg/test/matchers.h"
diff --git a/src/iceberg/test/test_resource.h b/src/iceberg/test/test_resource.h
index 2b20a0e7..5d51ca52 100644
--- a/src/iceberg/test/test_resource.h
+++ b/src/iceberg/test/test_resource.h
@@ -27,7 +27,7 @@
 
 #include <nlohmann/json.hpp>
 
-#include "iceberg/json_internal.h"
+#include "iceberg/json_serde_internal.h"
 #include "iceberg/result.h"
 #include "iceberg/table_metadata.h"
 #include "iceberg/test/test_config.h"

Reply via email to