Skip to content

Commit 429bdb9

Browse files
committed
Fix core dump
1 parent ee6b524 commit 429bdb9

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

cpp-ch/local-engine/Parser/TypeParser.cpp

+7-4
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ DB::DataTypePtr TypeParser::parseType(const substrait::Type & substrait_type, st
239239
}
240240

241241

242-
DB::Block TypeParser::buildBlockFromNamedStruct(const substrait::NamedStruct & struct_, const std::string & low_card_cols)
242+
DB::Block TypeParser::buildBlockFromNamedStruct(const substrait::NamedStruct & struct_, const std::string & low_card_cols, bool collect_normal_col_only)
243243
{
244244
std::unordered_set<std::string> low_card_columns;
245245
Poco::StringTokenizer tokenizer(low_card_cols, ",");
@@ -250,9 +250,12 @@ DB::Block TypeParser::buildBlockFromNamedStruct(const substrait::NamedStruct & s
250250
assert(struct_.column_types_size() == struct_.struct_().types_size());
251251

252252
std::set<int> non_normal_col_set;
253-
for (int i = 0; i < struct_.column_types_size(); ++i)
254-
if (struct_.column_types(i) != ::substrait::NamedStruct::NORMAL_COL)
255-
non_normal_col_set.insert(i);
253+
if (collect_normal_col_only)
254+
{
255+
for (int i = 0; i < struct_.column_types_size(); ++i)
256+
if (struct_.column_types(i) != ::substrait::NamedStruct::NORMAL_COL)
257+
non_normal_col_set.insert(i);
258+
}
256259

257260
DB::ColumnsWithTypeAndName internal_cols;
258261
internal_cols.reserve(struct_.names_size());

cpp-ch/local-engine/Parser/TypeParser.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ namespace local_engine
4444

4545
// low_card_cols is in format of "cola,colb". Currently does not nested column to be LowCardinality.
4646
static DB::Block buildBlockFromNamedStruct(const substrait::NamedStruct& struct_,
47-
const std::string& low_card_cols = "");
47+
const std::string& low_card_cols = "",
48+
bool collect_normal_col_only = false);
4849

4950
/// Build block from substrait NamedStruct without DFS rules, different from buildBlockFromNamedStruct
5051
static DB::Block buildBlockFromNamedStructWithoutDFS(const substrait::NamedStruct& struct_);

0 commit comments

Comments
 (0)