27#include <unordered_map>
29#include <nlohmann/json_fwd.hpp>
31#include "iceberg/result.h"
46ICEBERG_EXPORT nlohmann::json ToJson(
const SortField& sort_field);
57ICEBERG_EXPORT Result<std::unique_ptr<SortField>> SortFieldFromJson(
58 const nlohmann::json& json);
68ICEBERG_EXPORT nlohmann::json ToJson(
const SortOrder& sort_order);
80ICEBERG_EXPORT Result<std::unique_ptr<SortOrder>> SortOrderFromJson(
81 const nlohmann::json& json,
const std::shared_ptr<Schema>& current_schema);
88ICEBERG_EXPORT Result<std::unique_ptr<SortOrder>> SortOrderFromJson(
89 const nlohmann::json& json);
95ICEBERG_EXPORT nlohmann::json ToJson(
const Schema& schema);
101ICEBERG_EXPORT Result<std::string> ToJsonString(
const Schema& schema);
107ICEBERG_EXPORT Result<std::unique_ptr<Schema>> SchemaFromJson(
const nlohmann::json& json);
113ICEBERG_EXPORT nlohmann::json ToJson(
const Type& type);
119ICEBERG_EXPORT Result<std::unique_ptr<Type>> TypeFromJson(
const nlohmann::json& json);
125ICEBERG_EXPORT nlohmann::json ToJson(
const SchemaField& field);
131ICEBERG_EXPORT Result<std::unique_ptr<SchemaField>> FieldFromJson(
132 const nlohmann::json& json);
143ICEBERG_EXPORT nlohmann::json ToJson(
const PartitionField& partition_field);
156ICEBERG_EXPORT Result<std::unique_ptr<PartitionField>> PartitionFieldFromJson(
157 const nlohmann::json& json,
bool allow_field_id_missing =
false);
169ICEBERG_EXPORT nlohmann::json ToJson(
const PartitionSpec& partition_spec);
181ICEBERG_EXPORT Result<std::string> ToJsonString(
const PartitionSpec& partition_spec);
195ICEBERG_EXPORT Result<std::unique_ptr<PartitionSpec>> PartitionSpecFromJson(
196 const std::shared_ptr<Schema>& schema,
const nlohmann::json& json,
197 int32_t default_spec_id);
204ICEBERG_EXPORT Result<std::unique_ptr<PartitionSpec>> PartitionSpecFromJson(
205 const nlohmann::json& json);
211ICEBERG_EXPORT nlohmann::json ToJson(
const SnapshotRef& snapshot_ref);
217ICEBERG_EXPORT Result<std::unique_ptr<SnapshotRef>> SnapshotRefFromJson(
218 const nlohmann::json& json);
224ICEBERG_EXPORT nlohmann::json ToJson(
const Snapshot& snapshot);
230ICEBERG_EXPORT Result<std::unique_ptr<Snapshot>> SnapshotFromJson(
231 const nlohmann::json& json);
237ICEBERG_EXPORT nlohmann::json ToJson(
const StatisticsFile& statistics_file);
243ICEBERG_EXPORT Result<std::unique_ptr<StatisticsFile>> StatisticsFileFromJson(
244 const nlohmann::json& json);
250ICEBERG_EXPORT nlohmann::json ToJson(
251 const PartitionStatisticsFile& partition_statistics_file);
257ICEBERG_EXPORT Result<std::unique_ptr<PartitionStatisticsFile>>
258PartitionStatisticsFileFromJson(
const nlohmann::json& json);
264ICEBERG_EXPORT nlohmann::json ToJson(
const SnapshotLogEntry& snapshot_log_entry);
270ICEBERG_EXPORT Result<SnapshotLogEntry> SnapshotLogEntryFromJson(
271 const nlohmann::json& json);
277ICEBERG_EXPORT nlohmann::json ToJson(
const MetadataLogEntry& metadata_log_entry);
283ICEBERG_EXPORT Result<MetadataLogEntry> MetadataLogEntryFromJson(
284 const nlohmann::json& json);
290ICEBERG_EXPORT nlohmann::json ToJson(
const TableMetadata& table_metadata);
296ICEBERG_EXPORT Result<std::string> ToJsonString(
const TableMetadata& table_metadata);
302ICEBERG_EXPORT Result<std::unique_ptr<TableMetadata>> TableMetadataFromJson(
303 const nlohmann::json& json);
309ICEBERG_EXPORT Result<nlohmann::json> FromJsonString(
const std::string& json_string);
315ICEBERG_EXPORT Result<std::string> ToJsonString(
const nlohmann::json& json);
321ICEBERG_EXPORT nlohmann::json ToJson(
const MappedField& field);
327ICEBERG_EXPORT Result<MappedField> MappedFieldFromJson(
const nlohmann::json& json);
333ICEBERG_EXPORT nlohmann::json ToJson(
const MappedFields& mapped_fields);
339ICEBERG_EXPORT Result<std::unique_ptr<MappedFields>> MappedFieldsFromJson(
340 const nlohmann::json& json);
346ICEBERG_EXPORT nlohmann::json ToJson(
const NameMapping& name_mapping);
352ICEBERG_EXPORT Result<std::unique_ptr<NameMapping>> NameMappingFromJson(
353 const nlohmann::json& json);
359ICEBERG_EXPORT Result<std::string> UpdateMappingFromJsonString(
360 std::string_view mapping_json,
361 const std::unordered_map<int32_t, std::shared_ptr<SchemaField>>& updates,
362 const std::multimap<int32_t, int32_t>& adds);
369ICEBERG_EXPORT nlohmann::json ToJson(
const TableIdentifier& identifier);
375ICEBERG_EXPORT Result<TableIdentifier> TableIdentifierFromJson(
376 const nlohmann::json& json);
382ICEBERG_EXPORT nlohmann::json ToJson(
const Namespace& ns);
388ICEBERG_EXPORT Result<Namespace> NamespaceFromJson(
const nlohmann::json& json);
394ICEBERG_EXPORT nlohmann::json ToJson(
const TableUpdate& update);
400ICEBERG_EXPORT Result<std::unique_ptr<TableUpdate>> TableUpdateFromJson(
401 const nlohmann::json& json);
407ICEBERG_EXPORT nlohmann::json ToJson(
const TableRequirement& requirement);
413ICEBERG_EXPORT Result<std::unique_ptr<TableRequirement>> TableRequirementFromJson(
414 const nlohmann::json& json);