Resolve conflicts

This commit is contained in:
kssenii 2024-12-09 12:48:12 +01:00
parent 246f73e584
commit 9256d370c8
7 changed files with 16 additions and 26 deletions

View File

@ -5560,13 +5560,6 @@ Only available in ClickHouse Cloud. Exclude new data parts from SELECT queries u
)", 0) \
DECLARE(Int64, prefer_warmed_unmerged_parts_seconds, 0, R"(
Only available in ClickHouse Cloud. If a merged part is less than this many seconds old and is not pre-warmed (see cache_populated_by_fetch), but all its source parts are available and pre-warmed, SELECT queries will read from those parts instead. Only for ReplicatedMergeTree. Note that this only checks whether CacheWarmer processed the part; if the part was fetched into cache by something else, it'll still be considered cold until CacheWarmer gets to it; if it was warmed, then evicted from cache, it'll still be considered warm.
)", 0) \
DECLARE(Bool, iceberg_engine_ignore_schema_evolution, false, R"(
Allow to ignore schema evolution in Iceberg table engine and read all data using schema specified by the user on table creation or latest schema parsed from metadata on table creation.
:::note
Enabling this setting can lead to incorrect result as in case of evolved schema all data files will be read using the same schema.
:::
)", 0) \
DECLARE(Bool, allow_experimental_database_iceberg, false, R"(
Allow experimental database engine Iceberg

View File

@ -229,10 +229,11 @@ StoragePtr DatabaseIceberg::tryGetTable(const String & name, ContextPtr context_
storage_type = table_metadata.getStorageType();
const auto configuration = getConfiguration(storage_type);
auto storage_settings = std::make_unique<StorageObjectStorageSettings>();
/// with_table_structure = false: because there will be
/// no table structure in table definition AST.
StorageObjectStorage::Configuration::initialize(*configuration, args, context_, /* with_table_structure */false);
StorageObjectStorage::Configuration::initialize(*configuration, args, context_, /* with_table_structure */false, std::move(storage_settings));
return std::make_shared<StorageObjectStorage>(
configuration,

View File

@ -1,3 +1,4 @@
#pragma once
#include <Core/Types.h>
namespace DB

View File

@ -577,11 +577,11 @@ bool RestCatalog::getTableMetadataImpl(
if (result.requiresSchema())
{
const auto & settings = getContext()->getSettingsRef();
int format_version = metadata_object->getValue<int>("format-version");
auto schema = DB::IcebergMetadata::parseTableSchema(
metadata_object, log, format_version, settings[DB::Setting::iceberg_engine_ignore_schema_evolution]).first;
result.setSchema(schema);
// int format_version = metadata_object->getValue<int>("format-version");
auto schema_processor = DB::IcebergSchemaProcessor();
auto id = DB::IcebergMetadata::parseTableSchema(metadata_object, schema_processor, log);
auto schema = schema_processor.getClickhouseTableSchemaById(id);
result.setSchema(*schema);
}
if (result.requiresCredentials() && object->has("config"))

View File

@ -52,9 +52,6 @@ namespace ErrorCodes
extern const int LOGICAL_ERROR;
}
Int32 parseTableSchema(
const Poco::JSON::Object::Ptr & metadata_object, IcebergSchemaProcessor & schema_processor, LoggerPtr metadata_logger);
IcebergMetadata::IcebergMetadata(
ObjectStoragePtr object_storage_,
ConfigurationObserverPtr configuration_,
@ -125,7 +122,6 @@ bool operator!=(const Poco::JSON::Object & first, const Poco::JSON::Object & sec
{
return !(first == second);
}
}
DataTypePtr IcebergSchemaProcessor::getSimpleType(const String & type_name)

View File

@ -207,11 +207,8 @@ public:
bool supportsExternalMetadataChange() const override { return true; }
static std::pair<NamesAndTypesList, Int32> parseTableSchema(
const Poco::JSON::Object::Ptr & metadata_object,
LoggerPtr metadata_logger,
int format_version,
bool ignore_schema_evolution);
static Int32 parseTableSchema(
const Poco::JSON::Object::Ptr & metadata_object, IcebergSchemaProcessor & schema_processor, LoggerPtr metadata_logger);
private:
mutable std::unordered_map<String, Int32> schema_id_by_data_file;

View File

@ -104,10 +104,12 @@ StorageObjectStorage::StorageObjectStorage(
try
{
if (!lazy_init)
if (configuration->hasExternalDynamicMetadata())
configuration->updateAndGetCurrentSchema(object_storage, context);
else
configuration->update(object_storage, context);
{
if (configuration->hasExternalDynamicMetadata())
configuration->updateAndGetCurrentSchema(object_storage, context);
else
configuration->update(object_storage, context);
}
}
catch (...)
{