Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1153,16 +1153,12 @@ std::optional<size_t> IcebergMetadata::totalBytes(ContextPtr local_context) cons
std::optional<String> IcebergMetadata::partitionKey(ContextPtr context) const
{
auto [actual_data_snapshot, actual_table_state_snapshot] = getRelevantState(context);
if (!actual_data_snapshot)
return std::nullopt;
return getPartitionKey(context, actual_table_state_snapshot);
}

std::optional<String> IcebergMetadata::sortingKey(ContextPtr context) const
{
auto [actual_data_snapshot, actual_table_state_snapshot] = getRelevantState(context);
if (!actual_data_snapshot)
return std::nullopt;
auto metadata_object = getMetadataJSONObject(
actual_table_state_snapshot.metadata_file_path,
object_storage,
Expand Down
2 changes: 2 additions & 0 deletions src/Storages/ObjectStorage/DataLakes/Iceberg/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1324,6 +1324,8 @@ std::pair<Poco::JSON::Object::Ptr, Int32> parseTableSchemaV1Method(const Poco::J

KeyDescription getSortingKeyDescriptionFromMetadata(Poco::JSON::Object::Ptr metadata_object, const NamesAndTypesList & ch_schema, ContextPtr local_context)
{
if (!metadata_object->has(f_default_sort_order_id) || !metadata_object->has(f_sort_orders))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it impossible to have a table without sort order? I suppose so, but just asking.

return KeyDescription{};
auto sort_order_id = metadata_object->getValue<Int64>(f_default_sort_order_id);
Poco::JSON::Array::Ptr sort_orders = metadata_object->getArray(f_sort_orders);
std::unordered_map<Int64, String> source_id_to_column_name;
Expand Down
Loading