Repository: ClickHouse/ClickHouse
File: src/Storages/ObjectStorage/Utils.cpp (C++)

Code before:
    /// We don't check csv and tsv formats because they change column names.
    if (!validate_schema_with_remote
        || configuration.format == "CSV"
        || configuration.format == "TSV")
        return;

    /// Verify that explicitly specified columns exist in the schema inferred from data.
    String sample_path_schema = *sample_path;
    std::optional<ColumnsDescription> schema_file;
    try
    {
        schema_file = StorageObjectStorage::resolveSchemaFromData(
            object_storage,
            config_ptr,
            *format_settings,
            sample_path_schema,
            context);
    }
    catch (...)
    {
        tryLogCurrentException(log, "while verifying schema consistency", LogsLevel::debug);
    }
    if (schema_file)
    {
        std::unordered_set<String> hive_partitioning_columns;
        for (const auto & column_name : hive_partition_columns_to_read_from_file_path->getNames())
            hive_partitioning_columns.insert(column_name);
        for (const auto & column : *columns_in_table_or_function_definition)
            if (!schema_file->tryGet(column.name) && !hive_partitioning_columns.contains(column.name))
            {
                String hive_columns;
                for (const auto & hive_column : hive_partitioning_columns)
                    hive_columns += hive_column + ";";
                throw Exception(ErrorCodes::BAD_ARGUMENTS, "Cannot find column {} in schema {}, hive columns {}", column.name, schema_file->toString(false), hive_columns);
            }
    }
}

ASTs::iterator getFirstKeyValueArgument(ASTs & args)
{
    ASTs::iterator first_key_value_arg_it = args.end();
    for (auto it = args.begin(); it != args.end(); ++it)
    {
        const auto * function_ast = (*it)->as<ASTFunction>();
        if (function_ast && function_ast->name == "equals")
        {
             if (first_key_value_arg_it == args.end())
                first_key_value_arg_it = it;
        }
        else if (first_key_value_arg_it != args.end())
        {

Review comment (suggestion):
```suggestion
        auto hive_partitioning_columns = hive_partition_columns_to_read_from_file_path->getNameSet())
```
https://github.com/ClickHouse/ClickHouse/blob/ad8bc628d43657810a4ecdca08f0f0213a0bce8e/src/Core/NamesAndTypes.h#L105

Code after:
    if (!object_storage || !configuration || !format_settings || !sample_path || !context
        || !hive_partition_columns_to_read_from_file_path || !columns_in_table_or_function_definition || !log)
        return;

    /// We don't check csv and tsv formats because they change column names.
    if (!validate_schema_with_remote
        || configuration->format == "CSV"
        || configuration->format == "TSV")
        return;

    /// Verify that explicitly specified columns exist in the schema inferred from data.
    String sample_path_schema = *sample_path;
    std::optional<ColumnsDescription> schema_file;
    try
    {
        schema_file = StorageObjectStorage::resolveSchemaFromData(
            object_storage,
            configuration,
            *format_settings,
            sample_path_schema,
            context);
    }
    catch (...)
    {
        tryLogCurrentException(log, "while verifying schema consistency", LogsLevel::debug);
    }
    if (schema_file)
    {
        auto hive_partitioning_columns = hive_partition_columns_to_read_from_file_path->getNameSet();
        for (const auto & column : *columns_in_table_or_function_definition)
            if (!schema_file->tryGet(column.name) && !hive_partitioning_columns.contains(column.name))
            {
                String hive_columns;
                for (const auto & hive_column : hive_partitioning_columns)
                    hive_columns += hive_column + ";";
                throw Exception(ErrorCodes::BAD_ARGUMENTS, "Cannot find column {} in schema {}, hive columns {}", column.name, schema_file->toString(false), hive_columns);
            }
    }
}

ASTs::iterator getFirstKeyValueArgument(ASTs & args)
{
    ASTs::iterator first_key_value_arg_it = args.end();
    for (auto it = args.begin(); it != args.end(); ++it)
    {
        const auto * function_ast = (*it)->as<ASTFunction>();
        if (function_ast && function_ast->name == "equals")
        {
             if (first_key_value_arg_it == args.end())
                first_key_value_arg_it = it;
        }