Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix join key with alpha ASCII #390

Merged
merged 1 commit into from
Mar 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions utils/local-engine/Parser/SerializedPlanParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2188,9 +2188,19 @@ DB::QueryPlanPtr SerializedPlanParser::parseJoin(substrait::JoinRel join, DB::Qu
}
if (!right_table_alias.empty())
{
ActionsDAGPtr project = std::make_shared<ActionsDAG>(right->getCurrentDataStream().header.getNamesAndTypesList());
project->addAliases(right_table_alias);
QueryPlanStepPtr project_step = std::make_unique<ExpressionStep>(right->getCurrentDataStream(), project);
ActionsDAGPtr rename_dag = std::make_shared<ActionsDAG>(right->getCurrentDataStream().header.getNamesAndTypesList());
auto original_right_columns = right->getCurrentDataStream().header;
for (const auto & column_alias : right_table_alias)
{
if (original_right_columns.has(column_alias.first))
{
auto pos = original_right_columns.getPositionByName(column_alias.first);
const auto & alias = rename_dag->addAlias(*rename_dag->getInputs()[pos], column_alias.second);
rename_dag->getOutputs()[pos] = &alias;
}
}
rename_dag->projectInput();
QueryPlanStepPtr project_step = std::make_unique<ExpressionStep>(right->getCurrentDataStream(), rename_dag);
project_step->setStepDescription("Right Table Rename");
right->addStep(std::move(project_step));
}
Expand Down