Skip to content

Commit

Permalink
Fix core dump
Browse files Browse the repository at this point in the history
  • Loading branch information
baibaichen committed Jul 11, 2024
1 parent 0c1d86e commit ea41482
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
11 changes: 7 additions & 4 deletions cpp-ch/local-engine/Parser/TypeParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ DB::DataTypePtr TypeParser::parseType(const substrait::Type & substrait_type, st
}


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

std::set<int> non_normal_col_set;
for (int i = 0; i < struct_.column_types_size(); ++i)
if (struct_.column_types(i) != ::substrait::NamedStruct::NORMAL_COL)
non_normal_col_set.insert(i);
if (collect_normal_col_only)
{
for (int i = 0; i < struct_.column_types_size(); ++i)
if (struct_.column_types(i) != ::substrait::NamedStruct::NORMAL_COL)
non_normal_col_set.insert(i);
}

DB::ColumnsWithTypeAndName internal_cols;
internal_cols.reserve(struct_.names_size());
Expand Down
3 changes: 2 additions & 1 deletion cpp-ch/local-engine/Parser/TypeParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ namespace local_engine

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

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

0 comments on commit ea41482

Please sign in to comment.