From a188a702e2dc4a3c40c2490d52585a986d13f627 Mon Sep 17 00:00:00 2001 From: kevinyhzou Date: Fri, 26 Jul 2024 15:52:04 +0800 Subject: [PATCH] support set orc timezone name --- cpp-ch/local-engine/Common/CHUtil.cpp | 1 - .../Storages/SubstraitSource/ORCFormatFile.cpp | 7 +++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cpp-ch/local-engine/Common/CHUtil.cpp b/cpp-ch/local-engine/Common/CHUtil.cpp index 997e6d32028f3..b74c18dd14af1 100644 --- a/cpp-ch/local-engine/Common/CHUtil.cpp +++ b/cpp-ch/local-engine/Common/CHUtil.cpp @@ -770,7 +770,6 @@ void BackendInitializerUtil::initSettings(std::map & b settings.set("input_format_csv_trim_whitespaces", false); settings.set("input_format_csv_allow_cr_end_of_line", true); settings.set("output_format_orc_string_as_string", true); - settings.set("input_format_orc_read_use_writer_time_zone", true); settings.set("output_format_parquet_version", "1.0"); settings.set("output_format_parquet_compression_method", "snappy"); settings.set("output_format_parquet_string_as_string", true); diff --git a/cpp-ch/local-engine/Storages/SubstraitSource/ORCFormatFile.cpp b/cpp-ch/local-engine/Storages/SubstraitSource/ORCFormatFile.cpp index d213342f6d76b..66556e237f77b 100644 --- a/cpp-ch/local-engine/Storages/SubstraitSource/ORCFormatFile.cpp +++ b/cpp-ch/local-engine/Storages/SubstraitSource/ORCFormatFile.cpp @@ -24,6 +24,7 @@ # include # include # include +# include namespace local_engine { @@ -67,6 +68,12 @@ FormatFile::InputFormatPtr ORCFormatFile::createInputFormat(const DB::Block & he std::back_inserter(skip_stripe_indices)); format_settings.orc.skip_stripes = std::unordered_set(skip_stripe_indices.begin(), skip_stripe_indices.end()); + if (context->getConfigRef().has("timezone")) + { + const String config_timezone = context->getConfigRef().getString("timezone"); + const String mapped_timezone = DateTimeUtil::convertTimeZone(config_timezone); + format_settings.orc.reader_time_zone_name = mapped_timezone; + } auto input_format = std::make_shared(*file_format->read_buffer, header, format_settings); file_format->input = input_format; return file_format;