Skip to content
This repository was archived by the owner on May 6, 2024. It is now read-only.

Commit aedf4e3

Browse files
authored
[POAE7-2920]bypass reorder subexpression project: {a,b,c} -> {c,a} (#417)
* ignore reorder subexpression project: {a,b,c} -> {c,a} * bypass all bare column expressions
1 parent 177fa70 commit aedf4e3

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

cpp/src/cider-velox/benchmark/tpch/TpchFromFileBenchmark.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ std::shared_ptr<TpchQueryBuilder> queryBuilder;
245245
BENCHMARK_DRAW_LINE()
246246

247247
BENCHMARK_GROUP(1);
248-
// BENCHMARK_GROUP(3);
248+
BENCHMARK_GROUP(3);
249249
// BENCHMARK_GROUP(5);
250250
// BENCHMARK_GROUP(6);
251251
// BENCHMARK_GROUP(7);

cpp/src/cider-velox/src/ciderTransformer/CiderPlanPatterns.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -281,14 +281,19 @@ StatePtr ProjectStateMachine::Initial::accept(const VeloxPlanNodeAddr& nodeAddr)
281281
if (auto projectNode = std::dynamic_pointer_cast<const ProjectNode>(nodeAddr.nodePtr)) {
282282
const auto& inputType = projectNode->sources()[0]->outputType();
283283
const auto& outputType = projectNode->outputType();
284-
if ((inputType->equivalent(*(outputType))) &&
285-
(inputType->names() == outputType->names())) {
284+
if (inputType == outputType) {
286285
return std::make_shared<ProjectStateMachine::NotAccept>();
287286
}
288-
return std::make_shared<ProjectStateMachine::Project>();
289-
} else {
290-
return std::make_shared<ProjectStateMachine::NotAccept>();
287+
288+
for (const auto& proj : projectNode->projections()) {
289+
if (!dynamic_cast<const FieldAccessTypedExpr*>(proj.get())) {
290+
return std::make_shared<ProjectStateMachine::Project>();
291+
}
292+
}
293+
// all expression are bare field references.
294+
// we shoud bypass reorder subexpression project: {a, b, c} -> {c, a}
291295
}
296+
return std::make_shared<ProjectStateMachine::NotAccept>();
292297
}
293298

294299
bool ProjectStateMachine::accept(const VeloxPlanNodeAddr& nodeAddr) {

0 commit comments

Comments
 (0)