27#include <unordered_map>
29#include <nlohmann/json_fwd.hpp>
32#include "iceberg/result.h"
47ICEBERG_EXPORT nlohmann::json ToJson(
const SortField& sort_field);
58ICEBERG_EXPORT Result<std::unique_ptr<SortField>> SortFieldFromJson(
59 const nlohmann::json& json);
69ICEBERG_EXPORT nlohmann::json ToJson(
const SortOrder& sort_order);
81ICEBERG_EXPORT Result<std::unique_ptr<SortOrder>> SortOrderFromJson(
82 const nlohmann::json& json,
const std::shared_ptr<Schema>& current_schema);
89ICEBERG_EXPORT Result<std::unique_ptr<SortOrder>> SortOrderFromJson(
90 const nlohmann::json& json);
96ICEBERG_EXPORT Result<nlohmann::json> ToJson(
const Schema& schema);
102ICEBERG_EXPORT Result<std::string> ToJsonString(
const Schema& schema);
108ICEBERG_EXPORT Result<std::unique_ptr<Schema>> SchemaFromJson(
const nlohmann::json& json);
114ICEBERG_EXPORT Result<nlohmann::json> ToJson(
const Type& type);
120ICEBERG_EXPORT Result<std::unique_ptr<Type>> TypeFromJson(
const nlohmann::json& json);
126ICEBERG_EXPORT Result<nlohmann::json> ToJson(
const SchemaField& field);
132ICEBERG_EXPORT Result<std::unique_ptr<SchemaField>> FieldFromJson(
133 const nlohmann::json& json);
144ICEBERG_EXPORT nlohmann::json ToJson(
const PartitionField& partition_field);
157ICEBERG_EXPORT Result<std::unique_ptr<PartitionField>> PartitionFieldFromJson(
158 const nlohmann::json& json,
bool allow_field_id_missing =
false);
170ICEBERG_EXPORT nlohmann::json ToJson(
const PartitionSpec& partition_spec);
182ICEBERG_EXPORT Result<std::string> ToJsonString(
const PartitionSpec& partition_spec);
196ICEBERG_EXPORT Result<std::unique_ptr<PartitionSpec>> PartitionSpecFromJson(
197 const std::shared_ptr<Schema>& schema,
const nlohmann::json& json,
198 int32_t default_spec_id);
205ICEBERG_EXPORT Result<std::unique_ptr<PartitionSpec>> PartitionSpecFromJson(
206 const nlohmann::json& json);
212ICEBERG_EXPORT nlohmann::json ToJson(
const SnapshotRef& snapshot_ref);
218ICEBERG_EXPORT Result<std::unique_ptr<SnapshotRef>> SnapshotRefFromJson(
219 const nlohmann::json& json);
225ICEBERG_EXPORT nlohmann::json ToJson(
const Snapshot& snapshot);
231ICEBERG_EXPORT Result<std::unique_ptr<Snapshot>> SnapshotFromJson(
232 const nlohmann::json& json);
238ICEBERG_EXPORT nlohmann::json ToJson(
const StatisticsFile& statistics_file);
244ICEBERG_EXPORT Result<std::unique_ptr<StatisticsFile>> StatisticsFileFromJson(
245 const nlohmann::json& json);
251ICEBERG_EXPORT nlohmann::json ToJson(
252 const PartitionStatisticsFile& partition_statistics_file);
258ICEBERG_EXPORT Result<std::unique_ptr<PartitionStatisticsFile>>
259PartitionStatisticsFileFromJson(
const nlohmann::json& json);
265ICEBERG_EXPORT nlohmann::json ToJson(
const SnapshotLogEntry& snapshot_log_entry);
271ICEBERG_EXPORT Result<SnapshotLogEntry> SnapshotLogEntryFromJson(
272 const nlohmann::json& json);
278ICEBERG_EXPORT nlohmann::json ToJson(
const MetadataLogEntry& metadata_log_entry);
284ICEBERG_EXPORT Result<MetadataLogEntry> MetadataLogEntryFromJson(
285 const nlohmann::json& json);
291ICEBERG_EXPORT nlohmann::json ToJson(
const EncryptedKey& encrypted_key);
297ICEBERG_EXPORT Result<EncryptedKey> EncryptedKeyFromJson(
const nlohmann::json& json);
303ICEBERG_EXPORT Result<nlohmann::json> ToJson(
const TableMetadata& table_metadata);
309ICEBERG_EXPORT Result<std::string> ToJsonString(
const TableMetadata& table_metadata);
315ICEBERG_EXPORT Result<std::unique_ptr<TableMetadata>> TableMetadataFromJson(
316 const nlohmann::json& json);
322ICEBERG_EXPORT Result<nlohmann::json> FromJsonString(
const std::string& json_string);
328ICEBERG_EXPORT Result<std::string> ToJsonString(
const nlohmann::json& json);
334ICEBERG_EXPORT nlohmann::json ToJson(
const MappedField& field);
340ICEBERG_EXPORT Result<MappedField> MappedFieldFromJson(
const nlohmann::json& json);
346ICEBERG_EXPORT nlohmann::json ToJson(
const MappedFields& mapped_fields);
352ICEBERG_EXPORT Result<std::unique_ptr<MappedFields>> MappedFieldsFromJson(
353 const nlohmann::json& json);
359ICEBERG_EXPORT nlohmann::json ToJson(
const NameMapping& name_mapping);
365ICEBERG_EXPORT Result<std::unique_ptr<NameMapping>> NameMappingFromJson(
366 const nlohmann::json& json);
372ICEBERG_EXPORT Result<std::string> UpdateMappingFromJsonString(
373 std::string_view mapping_json,
374 const std::unordered_map<int32_t, std::shared_ptr<SchemaField>>& updates,
375 const std::multimap<int32_t, int32_t>& adds);
382ICEBERG_EXPORT nlohmann::json ToJson(
const TableIdentifier& identifier);
388ICEBERG_EXPORT Result<TableIdentifier> TableIdentifierFromJson(
389 const nlohmann::json& json);
395ICEBERG_EXPORT nlohmann::json ToJson(
const Namespace& ns);
401ICEBERG_EXPORT Result<Namespace> NamespaceFromJson(
const nlohmann::json& json);
407ICEBERG_EXPORT Result<nlohmann::json> ToJson(
const TableUpdate& update);
413ICEBERG_EXPORT Result<std::unique_ptr<TableUpdate>> TableUpdateFromJson(
414 const nlohmann::json& json);
420ICEBERG_EXPORT nlohmann::json ToJson(
const TableRequirement& requirement);
426ICEBERG_EXPORT Result<std::unique_ptr<TableRequirement>> TableRequirementFromJson(
427 const nlohmann::json& json);