Review fixes

This commit is contained in:
kssenii 2023-04-13 13:38:16 +02:00
parent 37691e573a
commit 3ac7f999bc
4 changed files with 8 additions and 8 deletions

View File

@ -159,7 +159,7 @@ DataTypes NamesAndTypesList::getTypes() const
return res;
}
void NamesAndTypesList::filterOut(const NameSet & names)
void NamesAndTypesList::filterColumns(const NameSet & names)
{
for (auto it = begin(); it != end();)
{

View File

@ -103,7 +103,7 @@ public:
DataTypes getTypes() const;
/// Remove columns which names are not in the `names`.
void filterOut(const NameSet & names);
void filterColumns(const NameSet & names);
/// Leave only the columns whose names are in the `names`. In `names` there can be superfluous columns.
NamesAndTypesList filter(const NameSet & names) const;

View File

@ -260,7 +260,7 @@ struct DeltaLakeMetadataParser<Configuration, MetadataReadHelper>::Impl
auto columns = ParquetSchemaReader(*buf, format_settings).readSchema();
/// Read only columns that we need.
columns.filterOut(NameSet{"add", "remove"});
columns.filterColumns(NameSet{"add", "remove"});
Block header;
for (const auto & column : columns)
header.insert({column.type->createColumn(), column.type, column.name});

View File

@ -71,23 +71,23 @@ struct HudiMetadataParser<Configuration, MetadataReadHelper>::Impl
throw Exception(ErrorCodes::LOGICAL_ERROR, "Unexpected format for file: {}", key);
const auto partition = key_file.parent_path().stem();
const auto file_id = file_parts[0];
const auto & file_id = file_parts[0];
const auto timestamp = parse<UInt64>(file_parts[2]);
auto & file_info = data_files[partition][file_id];
if (file_info.timestamp == 0 || file_info.timestamp < timestamp)
{
file_info.key = key;
file_info.key = std::move(key);
file_info.timestamp = timestamp;
}
}
Strings result;
for (const auto & [partition, partition_data] : data_files)
for (auto & [partition, partition_data] : data_files)
{
LOG_TRACE(log, "Adding {} data files from partition {}", partition, partition_data.size());
for (const auto & [file_id, file_data] : partition_data)
result.push_back(file_data.key);
for (auto & [file_id, file_data] : partition_data)
result.push_back(std::move(file_data.key));
}
return result;
}