Skip to content

Commit

Permalink
support set orc timezone name
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinyhZou committed Jul 26, 2024
1 parent 850e57b commit a188a70
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 0 additions & 1 deletion cpp-ch/local-engine/Common/CHUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,6 @@ void BackendInitializerUtil::initSettings(std::map<std::string, std::string> & 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
# include <Processors/Formats/Impl/ArrowBufferedStreams.h>
# include <Processors/Formats/Impl/NativeORCBlockInputFormat.h>
# include <Storages/SubstraitSource/OrcUtil.h>
# include <Common/CHUtil.h>

namespace local_engine
{
Expand Down Expand Up @@ -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<int>(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<DB::NativeORCBlockInputFormat>(*file_format->read_buffer, header, format_settings);
file_format->input = input_format;
return file_format;
Expand Down

0 comments on commit a188a70

Please sign in to comment.