Skip to content

Commit 02d12f6

Browse files
author
Chang chen
committed
Fix Build due to ClickHouse/ClickHouse#80931
1 parent 9cdfbe6 commit 02d12f6

20 files changed

+70
-52
lines changed

cpp-ch/local-engine/Storages/Parquet/VectorizedParquetRecordReader.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,6 @@ class VectorizedParquetBlockInputFormat final : public DB::IInputFormat
214214
protected:
215215
void onCancel() noexcept override { is_stopped = 1; }
216216

217-
// TODO: create ColumnIndexFilter here, currently disable it now.
218-
void setKeyCondition(const std::shared_ptr<const DB::KeyCondition> & key_condition_) override { }
219-
220217
public:
221218
VectorizedParquetBlockInputFormat(
222219
DB::ReadBuffer & in_,

cpp-ch/local-engine/Storages/SubstraitSource/ExcelTextFormatFile.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ bool ExcelTextFormatFile::useThis(const DB::ContextPtr & context)
6262
return settingsEqual(context->getSettingsRef(), USE_EXCEL_PARSER, "true");
6363
}
6464

65-
FormatFile::InputFormatPtr ExcelTextFormatFile::createInputFormat(const DB::Block & header)
65+
FormatFile::InputFormatPtr
66+
ExcelTextFormatFile::createInputFormat(const DB::Block & header, const std::shared_ptr<const DB::ActionsDAG> & /*filter_actions_dag*/)
6667
{
6768
auto read_buffer = read_buffer_builder->build(file_info);
6869

cpp-ch/local-engine/Storages/SubstraitSource/ExcelTextFormatFile.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ class ExcelTextFormatFile : public FormatFile
4747

4848
~ExcelTextFormatFile() override = default;
4949

50-
FormatFile::InputFormatPtr createInputFormat(const DB::Block & header) override;
50+
FormatFile::InputFormatPtr
51+
createInputFormat(const DB::Block & header, const std::shared_ptr<const DB::ActionsDAG> & filter_actions_dag = nullptr) override;
5152

5253
bool supportSplit() const override { return true; }
5354
String getFileFormat() const override { return "ExcelText"; }

cpp-ch/local-engine/Storages/SubstraitSource/FileReader.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -274,17 +274,12 @@ std::unique_ptr<NormalFileReader> createNormalFileReader(
274274
const FormatFilePtr & file,
275275
const DB::Block & to_read_header_,
276276
const DB::Block & output_header_,
277-
const std::shared_ptr<const DB::KeyCondition> & key_condition = nullptr,
277+
const std::shared_ptr<const DB::ActionsDAG> & filter_actions_dag = nullptr,
278278
const ColumnIndexFilterPtr & column_index_filter = nullptr)
279279
{
280280
file->initialize(column_index_filter);
281281
auto createInputFormat = [&](const DB::Block & new_read_header_) -> FormatFile::InputFormatPtr
282-
{
283-
auto input_format = file->createInputFormat(new_read_header_);
284-
if (key_condition && input_format)
285-
input_format->inputFormat().setKeyCondition(key_condition);
286-
return input_format;
287-
};
282+
{ return file->createInputFormat(new_read_header_, filter_actions_dag); };
288283

289284
if (file->getFileInfo().has_iceberg())
290285
return iceberg::IcebergReader::create(file, to_read_header_, output_header_, createInputFormat);
@@ -316,11 +311,13 @@ std::unique_ptr<NormalFileReader> createNormalFileReader(
316311
return std::make_unique<NormalFileReader>(file, to_read_header_, output_header_, input_format);
317312
}
318313
}
314+
315+
/// TODO Remove ColumnIndexFilterPtr
319316
std::unique_ptr<BaseReader> BaseReader::create(
320317
const FormatFilePtr & current_file,
321318
const DB::Block & readHeader,
322319
const DB::Block & outputHeader,
323-
const std::shared_ptr<const DB::KeyCondition> & key_condition,
320+
const std::shared_ptr<const DB::ActionsDAG> & filter_actions_dag,
324321
const ColumnIndexFilterPtr & column_index_filter)
325322
{
326323
if (!readHeader)
@@ -335,7 +332,7 @@ std::unique_ptr<BaseReader> BaseReader::create(
335332
}
336333
}
337334

338-
return createNormalFileReader(current_file, readHeader, outputHeader, key_condition, column_index_filter);
335+
return createNormalFileReader(current_file, readHeader, outputHeader, filter_actions_dag, column_index_filter);
339336
}
340337

341338

cpp-ch/local-engine/Storages/SubstraitSource/FileReader.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class BaseReader
7777
const FormatFilePtr & current_file,
7878
const DB::Block & readHeader,
7979
const DB::Block & outputHeader,
80-
const std::shared_ptr<const DB::KeyCondition> & key_condition,
80+
const std::shared_ptr<const DB::ActionsDAG> & filter_actions_dag,
8181
const ColumnIndexFilterPtr & column_index_filter);
8282
};
8383

cpp-ch/local-engine/Storages/SubstraitSource/FormatFile.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
namespace DB
3232
{
33+
class ActionsDAG;
3334
namespace ErrorCodes
3435
{
3536
extern const int NOT_IMPLEMENTED;
@@ -115,7 +116,9 @@ class FormatFile
115116
virtual ~FormatFile() = default;
116117

117118
/// Create a new input format for reading this file
118-
virtual InputFormatPtr createInputFormat(const DB::Block & header) = 0;
119+
virtual InputFormatPtr
120+
createInputFormat(const DB::Block & header, const std::shared_ptr<const DB::ActionsDAG> & filter_actions_dag = nullptr)
121+
= 0;
119122

120123
/// Spark would split a large file into small segements and read in different tasks
121124
/// If this file doesn't support the split feacture, only the task with offset 0 will generate data.
@@ -149,7 +152,6 @@ class FormatFile
149152
std::map<String, String> partition_values;
150153
/// partition keys are normalized to lower cases for partition column case-insensitive matching
151154
std::map<String, String> normalized_partition_values;
152-
std::shared_ptr<const DB::KeyCondition> key_condition;
153155
const FileMetaColumns meta_columns;
154156

155157
/// Currently, it is used to read an iceberg format, and initialized in the constructor of child class

cpp-ch/local-engine/Storages/SubstraitSource/Iceberg/IcebergReader.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@
1818

1919
#include <Storages/SubstraitSource/FileReader.h>
2020

21+
namespace DB
22+
{
23+
class ExpressionActions;
24+
using ExpressionActionsPtr = std::shared_ptr<ExpressionActions>;
25+
}
26+
2127
namespace local_engine
2228
{
2329
class DeltaDVRoaringBitmapArray;

cpp-ch/local-engine/Storages/SubstraitSource/JSONFormatFile.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ JSONFormatFile::JSONFormatFile(
3131
{
3232
}
3333

34-
FormatFile::InputFormatPtr JSONFormatFile::createInputFormat(const DB::Block & header)
34+
FormatFile::InputFormatPtr
35+
JSONFormatFile::createInputFormat(const DB::Block & header, const std::shared_ptr<const DB::ActionsDAG> & /*filter_actions_dag*/)
3536
{
3637
auto read_buffer = read_buffer_builder->buildWithCompressionWrapper(file_info);
3738

cpp-ch/local-engine/Storages/SubstraitSource/JSONFormatFile.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ class JSONFormatFile : public FormatFile
2828

2929
bool supportSplit() const override { return true; }
3030

31-
FormatFile::InputFormatPtr createInputFormat(const DB::Block & header) override;
31+
FormatFile::InputFormatPtr
32+
createInputFormat(const DB::Block & header, const std::shared_ptr<const DB::ActionsDAG> & filter_actions_dag = nullptr) override;
3233

3334
String getFileFormat() const override { return "JSONEachRow"; }
3435
};

cpp-ch/local-engine/Storages/SubstraitSource/ORCFormatFile.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ ORCFormatFile::ORCFormatFile(
3636
{
3737
}
3838

39-
FormatFile::InputFormatPtr ORCFormatFile::createInputFormat(const DB::Block & header)
39+
FormatFile::InputFormatPtr
40+
ORCFormatFile::createInputFormat(const DB::Block & header, const std::shared_ptr<const DB::ActionsDAG> & filter_actions_dag)
4041
{
4142
auto read_buffer = read_buffer_builder->build(file_info);
4243

@@ -70,7 +71,8 @@ FormatFile::InputFormatPtr ORCFormatFile::createInputFormat(const DB::Block & he
7071
format_settings.orc.reader_time_zone_name = mapped_timezone;
7172
}
7273
//TODO: support prefetch
73-
auto input_format = std::make_shared<DB::NativeORCBlockInputFormat>(*read_buffer, header, format_settings, false, 0);
74+
auto parser_group = std::make_shared<DB::FormatParserGroup>(context->getSettingsRef(), 1, filter_actions_dag, context);
75+
auto input_format = std::make_shared<DB::NativeORCBlockInputFormat>(*read_buffer, header, format_settings, false, 0, parser_group);
7476
return std::make_shared<InputFormat>(std::move(read_buffer), input_format);
7577
}
7678

0 commit comments

Comments
 (0)