1717#include < base/types.h>
1818#include < Common/SharedLockGuard.h>
1919#include < base/scope_guard.h>
20+ #include < Core/Settings.h>
2021
2122#include < DataTypes/DataTypeArray.h>
2223#include < DataTypes/DataTypeDate.h>
3233#include < DataTypes/NestedUtils.h>
3334#include < DataTypes/DataTypesNumber.h>
3435#include < Formats/FormatFactory.h>
36+ #include < Interpreters/Context_fwd.h>
37+ #include < Interpreters/Context.h>
3538
3639#include < IO/ReadHelpers.h>
3740
@@ -46,6 +49,10 @@ extern const int LOGICAL_ERROR;
4649extern const int BAD_ARGUMENTS;
4750}
4851
52+ namespace Setting
53+ {
54+ extern const SettingsTimezone timezone_for_iceberg_timestamptz;
55+ }
4956
5057namespace
5158{
@@ -221,7 +228,7 @@ NamesAndTypesList IcebergSchemaProcessor::tryGetFieldsCharacteristics(Int32 sche
221228 return fields;
222229}
223230
224- DataTypePtr IcebergSchemaProcessor::getSimpleType (const String & type_name)
231+ DataTypePtr IcebergSchemaProcessor::getSimpleType (const String & type_name, ContextPtr context_ )
225232{
226233 if (type_name == f_boolean)
227234 return DataTypeFactory::instance ().get (" Bool" );
@@ -240,7 +247,10 @@ DataTypePtr IcebergSchemaProcessor::getSimpleType(const String & type_name)
240247 if (type_name == f_timestamp)
241248 return std::make_shared<DataTypeDateTime64>(6 );
242249 if (type_name == f_timestamptz)
243- return std::make_shared<DataTypeDateTime64>(6 , " UTC" );
250+ {
251+ std::string timezone = context_->getSettingsRef ()[Setting::timezone_for_iceberg_timestamptz];
252+ return std::make_shared<DataTypeDateTime64>(6 , timezone);
253+ }
244254 if (type_name == f_string || type_name == f_binary)
245255 return std::make_shared<DataTypeString>();
246256 if (type_name == f_uuid)
@@ -323,7 +333,11 @@ IcebergSchemaProcessor::getComplexTypeFromObject(const Poco::JSON::Object::Ptr &
323333}
324334
325335DataTypePtr IcebergSchemaProcessor::getFieldType (
326- const Poco::JSON::Object::Ptr & field, const String & type_key, bool required, String & current_full_name, bool is_subfield_of_root)
336+ const Poco::JSON::Object::Ptr & field,
337+ const String & type_key,
338+ bool required,
339+ String & current_full_name,
340+ bool is_subfield_of_root)
327341{
328342 if (field->isObject (type_key))
329343 return getComplexTypeFromObject (field->getObject (type_key), current_full_name, is_subfield_of_root);
@@ -332,7 +346,7 @@ DataTypePtr IcebergSchemaProcessor::getFieldType(
332346 if (type.isString ())
333347 {
334348 const String & type_name = type.extract <String>();
335- auto data_type = getSimpleType (type_name);
349+ auto data_type = getSimpleType (type_name, getContext () );
336350 return required ? data_type : makeNullable (data_type);
337351 }
338352
0 commit comments